MIB compiler
smic [options...] includefile
- -0
- Set message (and error) file to output file.
- -1
- Print copyright.
- -2
- Print version.
- -3
- Allow INDEX clause on objects.
- -4
- Allow non-std access for objects.
- -5
- Allow ``optional'' status.
- -6
- No check on table, row, sequential names.
- -7
- Check for all index items in sequence.
- -8
- Output in MOSY Format.
- -9
- Output in Extended MOSY Format.
- -A
- Dump Alias names.
- -B
- Strong check size/range of index items.
- -C
- Check size/range.
- -D
- Dump all.
- -E
- Allow seq item syntax to match TC.
- -F file
- Name of output file.
- -G
- Turn off warnings for unused IMPORTs and textual conventions.
- -J
- Allow DEFVAL on Counter/Gauge.
- -K
- Dump SMI names.
- -I
- Print names of include files.
- -L
- Dump OID names.
- -M
- Dump module names.
- -N
- Dump OID tree and traps.
- -O
- Dump OID items.
- -Q
- Dump Sequences.
- -P
- Dump Trap names.
- -R
- Check INDEX objects for read-only.
- -S
- Dump string table.
- -T
- Dump IMPORT names.
- -U
- Print resource usage statistics.
- -V
- Dump Textual conventions.
- -W
- Strong check of seq item syntax.
- -X
- Suppress strings in scanner.
- -Z
- Output to file in intermediate format.
- includefile
- Name of the file that contains the order of modules to be compiled.
The smic MIB compiler can be used to check the syntax of SNMP MIB modules,
using varying levels of strictness. Using the options, you can specify
the output from the smic utility:
- Internal data structures used for debugging.
- Intermediate file that can be parsed by other programs.
- MOSY and Extended MOSY output.
- List of object name to object identifier assignments.
- List of defined traps.
The MIB compiler supports:
- Concise MIB format (rfc1212).
- Concise trap format (rfc1215).
- Multiple MIB modules.
- Items in IMPORTs.
- Textual conventions.
- Alias assignments for modules and object names.
- Selective checking of MIB constructs.
- Extensive MIB syntax checking and continuation of syntax checking after
syntax errors.
- Extensive checking of MIB consistency.
To use smic, you will first need to obtain the MIBs that you wish to
compile (ASN.1 modules). A common place to find MIBs are in RFCs. If the text
file that contains the MIB has any text before or after the MIB module,
that extra data must be stripped from the file
(see mstrip). These MIB modules
can be sorted into different directories. The SMICINCL environment variable can
then be used to define what directories the MIB module files exist in. The
current directory is searched first. For example:
setenv SMICINCL /usr/mibs/rfc:/usr/mibs/custom
Once you've collected your MIB modules, you'll need to create a
``MIB include file.'' This file is used to define what modules are to be
compiled, and in what order. The include directives must be ordered so that all
IMPORTed items must be defined in a previously included MIB. You can
also define other directives (see Include File).
Once these steps are complete, you can run the smic MIB compiler as:
smic includefile
There are a variety of options that you can define that effect how strict
the compiler does its syntax checking to what output is generated from the
compiler:
- Print out information regarding the type of objects and
files that smic has processed:
- -A, -D, -I, -K,
-M, -N, -O, -P,
-Q, -S, -T, -V
- Control the how strict the smic utility syntax checks
the MIB modules:
- -3, -4, -5, -6,
-7, -B, -C, -E,
-G, -J, -R, -W
- Supress the use of strings from the description and reference
clauses in the MIB text files. Since these elements take
up a significant amount of memory when they are being compiled, this option
can be useful if you have a limited amount of memory:
- -X
- Print the output generated by smic to a file instead
of stdout, the default:
- -F
The include file can consist of the following directives. Please see the
example for layout. These directives can also be placed in the MIB files,
but they can only be placed between the MIB modules.
- #help
- Print a list of directives.
- #include filename
- Include the filename in the compile. The filename must be in quotes, and
can contain several MIB modules.
- #aliasModule [module] [alias]
- The alias directives are used to define alternative names for the items in
the IMPORT statements. This includes the object and textual convention names
and the FROM module name. You can define more than one alias for each module.
For example, if you are using a MIB module file named RFC1271 and then it was
updated to RFC9999, you can use the aliasModule directive to avoid having to
change all of your other MIB files:
#aliasModule RFC9999 RFC1271
- #aliasSymbol [module] [object] [alias]
- This directive is used like the aliasModule directive. If the name of a textual
convention was changed, you can define an alias so you don't need
to change your other MIB files. You can define more than one alias for each
symbol. For example:
aliasSymbol RFC9999 OwnerStringXXX OwnerString
- #pushOpt
- The pushOpt directive allows you to save the current set of compile options
in you wish to change the options later on for specific MIB modules.
- #popOpt
- The popOpt directive is used to restore the last set of saved options.
- #addOpt options
- The addOpt directive is used to add compile options (in quotes) to the current
set of options being used to compile a module. For example:
addOpt "3 4 5 g"
- #removeOpt options
- The removeOpt directive is used to remove compile options (in quotes from
the current set of options being used to compile a module.
removeOpt "3 4 5 j"
- #printOpt
- This directive can be used to print out the current set of options.
Let's say you have six files that contain MIB modules. The first thing you would
do is specify the directories they exist in using the SMICINCL environment
variable. You can then create a MIB Include File:
#include "rfc1155.smi"
#include "rfc1212.smi"
#include "rfc1215.smi"
#include "rfc1213.mib"
#include "rfc1215.trp"
#pushOpt
#addOpt "c r w b 7"
#include "new.mib"
#popOpt
By using the option directives more strict syntax checking was
done on the new MIB modules. You can then run smic specifying
any compile options and any output generation options.
mstrip,
snmpbulkwalk,
snmpd,
snmpget,
snmpnetstat,
snmpset,
snmpstatus,
snmptest,
snmptranslate,
snmptrap,
snmptrapd,
snmpwalk