How to get OIDs from a MIB file?

pradipta picture pradipta · Sep 20, 2012 · Viewed 56.1k times · Source

I want to read all the objects from the MIB file that a manager has.

I developed one tool to get some data from a SNMP enabled agent. I want to enhance that tool by showing all the OIDs form the manager's MIB file.

I am using the NET-SNMP library.

I saw the following:

/usr/local/share/snmp/mibs/ 

folder and it contains many MIB files, but how can I form a list of the OIDs it has?

I went through the MIBs and saw the structures, but how do I get the OIDs of each and every object mentioned in the MIB files?

I want to list all the OIDs as follows:

  1. SNMPv2-MIB::sysDescr.0 = .1.3.6.1.2.1.1.1.0
  2. SNMPv2-MIB::sysObjectID.0 = .1.3.6.1.2.1.1.2.0 ... etc

I want to scan all the MIB files and find all the OIDs from the files.

How do I do this?

Answer

Massy picture Massy · Feb 22, 2013

Use snmptranslate-command from net-snmp library. Try it with the following paramenters:

-M "directory containing your MIB file"
-m ALL
-Pu
-Tso