Management Information Base (MIB) compiler


smic [options...] includefile

Runs on:



Set message (and error) file to output file.
Print copyright.
Print version.
Allow INDEX clause on objects.
Allow nonstandard access for objects.
Allow "optional" status.
No check on table, row, sequential names.
Check for all index items in sequence.
Output in MOSY Format.
Output in Extended MOSY Format.
Dump Alias names.
Strong check size/range of index items.
Check size/range.
Dump all.
Allow seq item syntax to match TC.
-F file
Name of output file.
Turn off warnings for unused IMPORTs and textual conventions.
Allow DEFVAL on Counter/Gauge.
Dump SMI names.
Print names of include files.
Dump OID names.
Dump module names.
Dump OID tree and traps.
Dump OID items.
Dump Sequences.
Dump Trap names.
Check INDEX objects for read-only.
Dump string table.
Dump IMPORT names.
Print resource usage statistics.
Dump Textual conventions.
Strong check of seq item syntax.
Suppress strings in scanner.
Output to file in intermediate format.
Name of the file that contains the order of modules to be compiled.


You can use the smic Management Information Base (MIB) compiler 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:

The MIB compiler supports:

To use smic, you 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). You can sort these MIB modules 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

Refining syntax checking

You can use a variety of options to control how strictly the compiler does its syntax checking, as well as what output it generates:

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 how strictly the smic utility syntax checks the MIB modules:
-3, -4, -5, -6, -7, -B, -C, -E, -G, -J, -R, -W
Suppress 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:
Print the output generated by smic to a file instead of stdout, the default:

Include File

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.

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
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.
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"
You can use this directive 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"

#addOpt "c r w b 7"

#include "new.mib"


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.

See also:

mstrip, snmpbulkwalk, snmpd, snmpget, snmpnetstat, snmpset, snmpstatus, snmptest, snmptranslate, snmptrap, snmptrapd, snmpwalk