Blame man/mib2c.conf.5.in

Packit fcad23
.TH MIB2C.CONF 5 "28 Apr 2004" VVERSIONINFO "Net-SNMP"
Packit fcad23
.SH NAME
Packit fcad23
mib2c.conf \- How to write mib2c.conf files to do ANYTHING based on MIB input.
Packit fcad23
.SH SYNOPSIS
Packit fcad23
% cat > mib2c.test.conf  << EOF
Packit fcad23
@foreach $t table@
Packit fcad23
  Starting table $t
Packit fcad23
  @foreach $c column@
Packit fcad23
    echo $t has column $c which has a syntax of $c.syntax
Packit fcad23
  @end@
Packit fcad23
Packit fcad23
@end@
Packit fcad23
EOF
Packit fcad23
Packit fcad23
% mib2c \-c mib2c.test.conf internet
Packit fcad23
.SH DESCRIPTION
Packit fcad23
The mib2c.conf script language is a MIB-particular language designed
Packit fcad23
to easily process MIB nodes in ways that you want.  mib2c is a
Packit fcad23
misnomer (for historical purposes), because you can produce anything
Packit fcad23
(not just C code).  Look in the Net-SNMP "local" directory for a bunch
Packit fcad23
of example mib2c.*.conf files and behold the power before you.
Packit fcad23
.SH COMMANDS
Packit fcad23
.PP
Packit fcad23
All commands within mib2c.conf files are embraced by @ signs.
Packit fcad23
Anything with an @ sign at the front and back of the line is generally
Packit fcad23
supposed to be a mib2c specific command.  These are detailed here:
Packit fcad23
COMMANDSHERE
Packit fcad23
.SH VARIABLES
Packit fcad23
.PP
Packit fcad23
Variables in the mib2c language look very similar to perl variables,
Packit fcad23
in that they start with a "$".  They can be used for anything you
Packit fcad23
want, but most typically they'll hold mib node names being processed
Packit fcad23
by @foreach ...@ clauses.
Packit fcad23
.PP
Packit fcad23
They also have a special properties when they are a mib node, such that
Packit fcad23
adding special suffixes to them will allow them to be interpreted in
Packit fcad23
some fashion.  The easiest way to understand this is through an
Packit fcad23
example.  If the variable 'x' contained the word 'ifType' then some
Packit fcad23
magical things happen.  In mib2c output, anytime $x is seen it is
Packit fcad23
replaced with "ifType".  Additional suffixes can be used to get other
Packit fcad23
aspects of that mib node though.  If $x.objectID is seen, it'll be
Packit fcad23
replaced by the OID for ifType: ".1.3.6.1.2.1.2.2.1.3".  Other
Packit fcad23
suffixes that can appear after a dot are listed below.
Packit fcad23
.PP
Packit fcad23
One last thing: you can use things like $vartext immediately ending in
Packit fcad23
some other text, you can use {}s to get proper expansion of only part
Packit fcad23
of the mib2c input.  IE, $xtext will produce "$xtext", but ${x}text
Packit fcad23
will produce "ifTypetext" instead.
Packit fcad23
VAREXPANSIONSHERE
Packit fcad23
.SH SEE ALSO
Packit fcad23
.PP
Packit fcad23
mib2c(1)