MIB definition is one of the more time-consuming steps of creating a module. MIB syntax can be quite complicated, and is outside the scope of this document. Refer to Related Reading for suggestions of other sources of information about MIB syntax.
Tip - The mib2c tool, used for converting MIBs to C code, includes error checking for MIB syntax. You can use mib2c to check your MIB syntax as you create your MIB, even before you are ready to convert the MIB.
You should consider using one of the standard MIBs that are included with the SMA as a model for creating your MIB. The /etc/sma/snmp/mibs directory contains all the standard MIBs supported by the SMA.
Tip - Pay particular attention to the name that is assigned for the MODULE-IDENTITY. This name should be equal to the MIB file name with the hyphens removed, and in mixed case. For example, SUN-SEA-EXTENSIONS-MIB.txt uses sunSeaExtensionsMIB for the MODULE-IDENTITY. A MIB file that does not use this format might not work with mib2c.
The file NET-SNMP-EXAMPLES-MIB.txt is also included in the /etc/sma/snmp/mibs directory, and might be helpful in explaining how to define a variety of MIB variable types.
You must ensure unique names for your MIB files. All custom MIBs to be used with SMA are in the same namespace as the standard MIBs, even if you keep the custom MIBs in a separate directory. Most of the MIBs derived from RFCs have RFC numbers in their names to clearly identify the MIBs, and ensure unique names. Other MIBs follow naming conventions, which decrease the chances of duplicate names.
MIBs are usually named with the following conventions:
Use all uppercase letters, and use hyphens to separate segments of the file name.
Begin the MIB name with your company name. For example, if the MIB is for a company that is named Acme, the first segment of the MIB name might be ACME.
Indicate the type of objects in the middle of the name. For example, if the MIB is for a router, you could use ROUTER in the middle of the name.
Include MIB as the last segment of the name.
Append a .txt file extension.
A sample name that uses these conventions is ACME-ROUTER-MIB.txt.