Understanding SNMP walks

  Uncategorized

SNMP v2 Walk Command

Walk the device to see what might be interesting on it.

snmpwalk -v2c -c COMMUNITY IP.ADD.RE.SS
snmpwalk -v2c -c netbotz 10.90.34.172:1024
# To view all MIBs
snmpwalk -v2c -c netbotz -m all 10.90.34.172:1024

Note: This might limit the results of the walk. To view EVERYTHING, start at ‘.1’

snmpwalk -v2c -c netbotz -m all 10.90.34.172:1024 .1

Understanding SNMP walks

Return values:

  • INTEGER: -2^31 to 2^31-1, or -2,147,483,648 to 2,147,483,647
    • Also used for enumerations: 1 (Up), 2 (Down), 3 (Testing), 4 (Unknown)
    • Does not return floating point values. All numeric values are integers.
    • As such, a value like 26.5 MIGHT be returned as 265
      • STRING values may be included to show the actual value, but these are “strings”. (Think binary)
  • Counter32: -2^31 to 2^31-1, or -2,147,483,648 to 2,147,483,647 (Same as Integers)

    • Not used for enumerations, so does not allow the text identifier

SNMP has 2 types of OIDs:

  • Scaler: Only a single value
    • Always end in .0
      • Use the .0 in Zenoss Monitoring Templates!
    • Device level?
  • Tables: Multiple values for a device
    • OIDs ending in non Zero are rows in a table
    • Component level?

Example:

IF-MIB::ifNumber.0 = INTEGER: 2
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifIndex.2 = INTEGER: 2
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth0
...
IF-MIB::ifSpeed.1 = Gauge32: 10000000
IF-MIB::ifSpeed.2 = Gauge32: 100000000
  • Note: ‘if’ stands for InterFace
  • ifNumber.0 is Scaler.
    • Tells us there are 2 interfaces
  • ifIndex.1 and ifIndex.2 are rows in a table.
    • Values define the index number for each interface.
  • ifDescr.x: Description (Name) of each interface
  • ifSpeed.x: Interface speed in bps

Note: For “less obvious” OID translation, you’ll need to search or use the MIB to understand what they are: (Get the full OID shown below and search for that!)

Translating a “friendly” OID description to numerical format

Use the Friendly Name as the Data Source.Data Point name and the OID as the value to collect in your Monitoring Templates.

Notes:

  • For scaler values, you must add the .0 at the end of the OID!
  • It doesn’t seem to matter if the OID starts with the initial ‘.’ (dot) or not.
snmptranslate -On MIB_NAME::FRIENDLY_NAME.x
snmptranslate -On IF-MIB::ifNumber.0
> .1.3.6.1.2.1.2.1.0
snmptranslate -On IF-MIB::ifSpeed
> .1.3.6.1.2.1.2.2.1.5
snmptranslate -On IF-MIB::ifSpeed.2
> .1.3.6.1.2.1.2.2.1.5.2

Walking a MIB

See what is unique to a device by walking its MIB using smidump

smidump -f identifiers /PATH/TO/MIB/MIB-NAME.mib
# Filter what you're looking for
smidump -f identifiers /PATH/TO/MIB/MIB-NAME.mib | grep -Ei SEARCH_TEXT
smidump -f identifiers /usr/share/snmp/mibs/NETBOTZV2-MIB.mib | grep -Ei temp

 

LEAVE A COMMENT