Wednesday, January 30, 2013

SNMP ObjectID Hierarchy



SNMP MIB Object tree/name space is hierarchical in structure rooted at root(.). This structure allows each manageable object to have its own globally unique name. This structure made SNMP modular. Each name space can be expanded without interfering/consulting with other name space or internet authority.
For example: name space assigned to CISCO is .1.3.6.1.4.1.9 [ root.iso.org.dod.internet.private. enterprises.cisco ] which is defined in CISCO-SMI MIB file and CISCO has the authority to assign names to objects anywhere below that name space. Object Identifier(OID) is written as a sequence of sub-identifiers separated with a period, starting at the root and ending at the object.

For in-depth explanation, refer to RFCs for SMI(Structure of Management Information):  RFC1155 (SNMP-SMI) and RFC2578 (SNMPv2-SMI)

Use CISCO OID Translator and Object Tree browser for more insights.

You can also look into MIB files to understand each network/device management objects.
In Linux, you should be able to locate MIB files under /usr/local/share/snmp/mibs
In Windows, you should be able to locate MIB files under %systemroot%\system32

Click here for basic tutorial on SNMP.
Install net-snmp if your system doesn't have snmp commands like snmpwalk, snmpget, snmpbulkget, etc.

snmpwalk is the easiest command to start with.
#snmpwalk -v <version>  -c  <Community_String>  -m ALL  <IP_ADDRESS_or_Domain_Name>   <Object_Name_or_Object_ID>

OPTIONS:
  -v 1|2c|3             specifies SNMP version to use
  -c COMMUNITY          set the community string
  -m MIB[:...]          load given list of MIBs (ALL loads everything)

Example1: To retrieve all SNMP objects under ISO for a network device(myserver.com):
#snmpwalk -v 2c  -c public  -m ALL  myserver.com   .1
or
#snmpwalk -v 2c -c public -m ALL myserver.com  iso

Example2: To retrieve all CISCO specific SNMP objects of a network device(myciscorouter.com) [ Note: For human readable objects, download CISCO specific MIB files and copy those files to /usr/local/share/snmp/mibs ]
#snmpwalk -v 2c  -c public  -m ALL  myciscorouter.com  .1.3.6.1.4.1.9
or
#snmpwalk -v 2c  -c public  -m ALL  myciscorouter.com   cisco