Difference between revisions of "Loading your own MIBs"

From Net-SNMP Wiki
Jump to: navigation, search
(A broken MIB)
 
(One intermediate revision by the same user not shown)
Line 17: Line 17:
 
If you have a syntax error in your MIB file, even if you do everything else right snmptranslate and related tools will still fail to find it.
 
If you have a syntax error in your MIB file, even if you do everything else right snmptranslate and related tools will still fail to find it.
  
A good thing to do '''always''' before trying to use your MIB is run it through a syntax checker.  The best freely-available syntax checker out there is probably [ http://www.ibr.cs.tu-bs.de/projects/libsmi/smilint.html smilint] from the [http://www.ibr.cs.tu-bs.de/projects/libsmi/ libsmi] package.
+
A good thing to do '''always''' before trying to use your MIB is run it through a syntax checker.  The best freely-available syntax checker out there is probably [http://www.ibr.cs.tu-bs.de/projects/libsmi/smilint.html smilint] from the [http://www.ibr.cs.tu-bs.de/projects/libsmi/ libsmi] package.
  
 
'''Before you do anything else with your mib, install libsmi and run smilint on your MIB'''
 
'''Before you do anything else with your mib, install libsmi and run smilint on your MIB'''

Latest revision as of 17:38, 19 December 2013

Good Answer

This is a Good Answer article. It was likely created as a response to a question on a Net-SNMP Mailing List and written up here for others to see. It likely covers material not yet in the FAQ or in the Tutorial but may someday be moved there

Question

I've created my own MIB, placed it in /usr/share/snmp/mibs (which is where I believe it should go) but yet snmptranslate and the other tools fail to find it.

Answer

It is highly likely that one of the following issues is you problem:

Simple understanding of the MIB loading process is needed

There is a good tutorial on loading MIBs into the tools. Please make sure you read the Using and loading MIBS page too.

A broken MIB

If you have a syntax error in your MIB file, even if you do everything else right snmptranslate and related tools will still fail to find it.

A good thing to do always before trying to use your MIB is run it through a syntax checker. The best freely-available syntax checker out there is probably smilint from the libsmi package.

Before you do anything else with your mib, install libsmi and run smilint on your MIB

Incorrect paths

It is also possible that your MIB loading paths are incorrect. You can always add the -M flag to your tool to make sure your directory is being searched:

 snmptranslate -M +/my/path/to/my/mibs

Debugging what is actually going on will help too (see below)

Proper MIB Node Naming

The best test you could do to try and load you mib is using your MIB name and the mib node name in combination. This is the safest loading test:

 snmptranslate MY-NAMED-MIB::myMibNodeName

MIB loading debugging

When all else fails, be prepared to examine the dump details for exactly what might be going wrong as it loads the MIBs. To do this (which requires net-snmp was build with the debugging output left in place) use the -Dparse flag:

 snmptranslate -Dparse MY-NAMED-MIB::myMibNodeName

warning: lots of (useful) data will be printed