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 . [ ] 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>

  -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(
#snmpwalk -v 2c  -c public  -m ALL   .1
#snmpwalk -v 2c -c public -m ALL  iso

Example2: To retrieve all CISCO specific SNMP objects of a network device( [ 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  .
#snmpwalk -v 2c  -c public  -m ALL   cisco

No comments: