FAQ:MIBs 08
How do I replace MIB values with new ones?
The Net-SNMP parser generally takes the first definition it sees for each object in the MIB hierarchy. Even if you specify your file to be read first, if the IMPORTS clauses reference a MIB with competing objects, those objects will be parsed first.
When specifying the Replace MIB command-line option (-PR
), the parser
will use definitions sourced from the most recent MIB file.
The parser will replace MIB objects when the sub-identifier and name match.
Caution: Using Replace MIB, there is NO guarantee that the resulting
MIB tree will be correct. Other MIB objects matching the name but
not the sub-identifier will persist. Sub-hierarchies may be reparented.
In particular, random access searching [see man 1 snmpcmd
]
may give unexpected result.
The Replace MIB option is experimental, buyer beware, carpe diem, etc.
Here are a few considerations to help you obtain good results. These hold true even if you never use the Replace MIB feature. Your suggestions for improvement are welcomed.
- The parser searches the specified directories and attempt to parse every file whose path does not begin with "." (period). Remove (or rename) older MIB files from these directories. Rename "README" to ".README", etc.
- Hint: the parser's module list is in LIFO order. You may see better results if the directory with the most correct MIB files is specified last in the MIBDIRS environment.
- Constrain the parser to not read in default MIB files by setting the MIBS environmental variable to the appropriate separator character (semi-colon on win32, colon everywhere else). Setting this to "" may also have the same effect.
- The MIBFILES environment can specify the path of the new MIB file.
Within a program, the call:
/* 4.2.x */ ds_set_boolean(DS_LIBRARY_ID, DS_LIB_MIB_REPLACE, 1 | 0);
or, if using the 5.0.x series code:
/* 5.0.x */ netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_REPLACE, 1 | 0);
will enable or disable the Replace MIB feature respectively. If you're having problems loading a particular MIB file, this call can be used to disable this feature, before using read_mib() to load the required file, and then re-enabling the Replace MIB feature. (or vice versa, as appropriate).
FAQ:MIBs
- Where can I find a MIB compiler?
- Why aren't my MIB files being read in?
- Where should I put my MIB files?
- What does "Cannot find module (XXX-MIB)" mean?
- I'm getting answers, but they're all numbers. Why?
- What does "unlinked OID" mean?
- The parser doesn't handle comments properly. Why not?
- How can I get more information about problems with MIB files?
- What's this about "too many imported symbols"?
- Do I actually need the MIB files?