Investigate data arranged in SNMP tables

snmp
how-to

#1

Using snmpwalk is a common way to investigate data provided by an SNMP agent. To have a better representation how the table of SNMP data is related you can use the snmptable command. The following example will show you the all related information from the interface table:

snmptable -v 2c -c mycommunity 172.24.23.100 IF-MIB::ifTable

The output is represented as the following which makes it easier to decide what can be used for a data collection:

SNMP table: IF-MIB::ifTable

 ifIndex                                                  ifDescr           ifType ifMtu    ifSpeed     ifPhysAddress ifAdminStatus ifOperStatus ifLastChange ifInOctets ifInUcastPkts ifInNUcastPkts ifInDiscards ifInErrors ifInUnknownProtos ifOutOctets ifOutUcastPkts ifOutNUcastPkts ifOutDiscards ifOutErrors ifOutQLen              ifSpecific
       1                                                       lo softwareLoopback 65536   10000000                              up           up 0:0:00:00.00   68649342        100067              0            0          0                 0    68649342         100067               0             0           0         0 SNMPv2-SMI::zeroDotZero
       2 Broadcom Limited NetXtreme BCM5720 Gigabit Ethernet PCIe   ethernetCsmacd  1500 1000000000 d0:bf:9c:45:44:4c            up           up 0:0:00:00.00 2412873064      13815361           9899            0          0                 0  2174177953        8705592               0             0           0         0 SNMPv2-SMI::zeroDotZero
       3 Broadcom Limited NetXtreme BCM5720 Gigabit Ethernet PCIe   ethernetCsmacd  1500          0 d0:bf:9c:45:44:4d            up         down 0:0:00:00.00          0             0              0            0          0                 0           0              0               0             0           0         0 SNMPv2-SMI::zeroDotZero
       4                                                      VPN   ethernetCsmacd  1500   10000000   4a:7:d6:5:cb:28            up           up 0:0:00:00.00  879232518       4735599              0         2570          0                 0   433978614        3122687               0             0           0         0 SNMPv2-SMI::zeroDotZero
       5                                          br-4e8ea5793a1f   ethernetCsmacd  1500          0  2:42:75:61:bf:74            up           up 0:0:00:33.85        122             3              0            0          0                 0        2233             28               0             0           0         0 SNMPv2-SMI::zeroDotZero
       6                                          br-6334982f770e   ethernetCsmacd  1500          0  2:42:18:bf:a0:e2            up           up 0:0:00:30.85     631633           275              0            0          0                 0       32830            417               0             0           0         0 SNMPv2-SMI::zeroDotZero
       7                                                  docker0   ethernetCsmacd  1500          0  2:42:6e:4c:6b:37            up         down 0:0:00:21.85          0             0              0            0          0                 0           0              0               0             0           0         0 SNMPv2-SMI::zeroDotZero
       8                                          br-b637ab856d8e   ethernetCsmacd  1500          0  2:42:96:4f:14:9b            up           up 0:0:00:30.85    4595246          9979              0            0          0                 0     1527135           9841               0             0           0         0 SNMPv2-SMI::zeroDotZero
       9                                          br-b8bdd17fedb4   ethernetCsmacd  1500          0  2:42:ba:d6:4e:93            up           up 0:0:00:30.85  681868178       6094935              0            0          0                 0   588927875        3845156               0             0           0         0 SNMPv2-SMI::zeroDotZero
      10                                          br-f8be5af66b88   ethernetCsmacd  1500          0  2:42:69:65:99:ba            up           up 0:0:00:33.85    7422116        139594              0            0          0                 0   667868085         209704               0             0           0         0 SNMPv2-SMI::zeroDotZero
      11                                          br-07fd24839979   ethernetCsmacd  1500          0  2:42:72:89:31:ae            up           up 0:0:00:30.85 1796105679       6541988              0            0          0                 0  1872524381        9238323               0             0           0         0 SNMPv2-SMI::zeroDotZero
      13                                              vethcd85e6a   ethernetCsmacd  1500 4294967295 32:34:51:e2:67:db            up           up 0:0:00:30.85    4734952          9979              0            0          0                 0     1528981           9866               0             0           0         0 SNMPv2-SMI::zeroDotZero
      15                                              vethc602d5b   ethernetCsmacd  1500 4294967295 f2:89:c5:72:64:f4            up           up 0:0:00:30.85  767197268       6094935              0            0          0                 0   588929721        3845181               0             0           0         0 SNMPv2-SMI::zeroDotZero
      17                                              veth4f8dc26   ethernetCsmacd  1500 4294967295 9e:b2:2b:1c:ed:36            up           up 0:0:00:33.85    9376432        139594              0            0          0                 0   667869931         209729               0             0           0         0 SNMPv2-SMI::zeroDotZero
      19                                              veth72a2903   ethernetCsmacd  1500 4294967295 a6:13:69:2e:25:80            up           up 0:0:00:33.85        164             3              0            0          0                 0        4079             53               0             0           0         0 SNMPv2-SMI::zeroDotZero
      21                                              veth256255f   ethernetCsmacd  1500 4294967295  6e:fa:a1:0:ff:bf            up           up 0:0:00:30.85 1887693987       6542002              0            0          0                 0  1872526157        9238347               0             0           0         0 SNMPv2-SMI::zeroDotZero
      23                                              veth73604b7   ethernetCsmacd  1500 4294967295 ca:50:4e:b8:72:94            up           up 0:0:00:30.85     150220           312              0            0          0                 0       92493            353               0             0           0         0 SNMPv2-SMI::zeroDotZero
      25                                              veth66b2ec1   ethernetCsmacd  1500 4294967295 1a:94:f9:aa:8e:8d            up           up 0:0:00:36.86     180085           325              0            0          0                 0      156398            384               0             0           0         0 SNMPv2-SMI::zeroDotZero
      27                                              vethb54c749   ethernetCsmacd  1500 4294967295  ba:77:88:8:4f:b9            up           up 0:0:00:42.86     638429           301              0            0          0                 0      125504            460               0             0           0         0 SNMPv2-SMI::zeroDotZero

:point_up: The snmptable command relies on having a relevant MIB file available and loaded in order to know which columns to retrieve.