
I recently upgraded Zabbix from version 6.0 to 7.0, and one of the major improvements is that you can use SNMP GETBULK when performing low-level discovery.
In this post, we will discover all the object identifiers (OIDs) representing the interface names (which start at OID 1.3.6.1.2.1.31.1.1.1.1) for a Cisco Nexus switch with IP 192.0.2.1.
The old discovery way – SNMP GET
To get the value of the (single) next OID you can use the snmpgetnext
command:
$ snmpgetnext -On -v 2c -c example 192.0.2.1 1.3.6.1.2.1.31.1.1.1.1
.1.3.6.1.2.1.31.1.1.1.1.83886080 = STRING: mgmt0
The snmpgetnext
command will in this example make Zabbix send a get-next-request packet to 192.0.2.1, and 192.0.2.1 will respond with a get-response packet:
Src Dest Info
Zabbix 192.0.2.1 get-next-request
1.3.6.1.2.1.31.1.1.1.1
192.0.2.1 Zabbix get-response
1.3.6.1.2.1.31.1.1.1.1.83886080
To get the entire OID tree you can use the snmpwalk
command:
$ snmpwalk -On -v 2c -c example 192.0.2.1 1.3.6.1.2.1.31.1.1.1.1
.1.3.6.1.2.1.31.1.1.1.1.83886080 = STRING: mgmt0
.1.3.6.1.2.1.31.1.1.1.1.151060481 = STRING: Vlan1
.1.3.6.1.2.1.31.1.1.1.1.335544320 = STRING: loopback0
.1.3.6.1.2.1.31.1.1.1.1.335544574 = STRING: loopback254
.1.3.6.1.2.1.31.1.1.1.1.436207616 = STRING: Ethernet1/1
.1.3.6.1.2.1.31.1.1.1.1.436208128 = STRING: Ethernet1/2
.1.3.6.1.2.1.31.1.1.1.1.436208640 = STRING: Ethernet1/3
.1.3.6.1.2.1.31.1.1.1.1.436209152 = STRING: Ethernet1/4
.1.3.6.1.2.1.31.1.1.1.1.436209664 = STRING: Ethernet1/5
.1.3.6.1.2.1.31.1.1.1.1.436210176 = STRING: Ethernet1/6
.1.3.6.1.2.1.31.1.1.1.1.436210688 = STRING: Ethernet1/7
.1.3.6.1.2.1.31.1.1.1.1.436211200 = STRING: Ethernet1/8
.1.3.6.1.2.1.31.1.1.1.1.436211712 = STRING: Ethernet1/9
.1.3.6.1.2.1.31.1.1.1.1.436212224 = STRING: Ethernet1/10
.1.3.6.1.2.1.31.1.1.1.1.436212736 = STRING: Ethernet1/11
.1.3.6.1.2.1.31.1.1.1.1.436213248 = STRING: Ethernet1/12
.1.3.6.1.2.1.31.1.1.1.1.436213760 = STRING: Ethernet1/13
.1.3.6.1.2.1.31.1.1.1.1.436214272 = STRING: Ethernet1/14
.1.3.6.1.2.1.31.1.1.1.1.436214784 = STRING: Ethernet1/15
.1.3.6.1.2.1.31.1.1.1.1.436215296 = STRING: Ethernet1/16
The snmpwalk
command will repeatedly send SNMP g
et-next-request packets to 192.0.2.1 until the OID tree is built.
The new discovery way – SNMP GETBULK
SNMP supports the ability to retrieve multiple OIDs in a single request with the snmpbulkget
command:
$ snmpbulkget -On -v 2c -c example 192.0.2.1 1.3.6.1.2.1.31.1.1.1.1
.1.3.6.1.2.1.31.1.1.1.1.83886080 = STRING: mgmt0
.1.3.6.1.2.1.31.1.1.1.1.151060481 = STRING: Vlan1
.1.3.6.1.2.1.31.1.1.1.1.335544320 = STRING: loopback0
.1.3.6.1.2.1.31.1.1.1.1.335544574 = STRING: loopback254
.1.3.6.1.2.1.31.1.1.1.1.436207616 = STRING: Ethernet1/1
.1.3.6.1.2.1.31.1.1.1.1.436208128 = STRING: Ethernet1/2
.1.3.6.1.2.1.31.1.1.1.1.436208640 = STRING: Ethernet1/3
.1.3.6.1.2.1.31.1.1.1.1.436209152 = STRING: Ethernet1/4
.1.3.6.1.2.1.31.1.1.1.1.436209664 = STRING: Ethernet1/5
.1.3.6.1.2.1.31.1.1.1.1.436210176 = STRING: Ethernet1/6
Similar to snmpwalk
, the snmpbulkwalk
command will repeatedly send SNMP getBulkRequest packets to the device until the OID tree is built:
Src Dest Info
Zabbix 192.0.2.1 getBulkRequest
1.3.6.1.2.1.31.1.1.1.1
192.0.2.1 Zabbix get-response
1.3.6.1.2.1.31.1.1.1.1.83886080
1.3.6.1.2.1.31.1.1.1.1.151060481
1.3.6.1.2.1.31.1.1.1.1.335544320
1.3.6.1.2.1.31.1.1.1.1.335544574
1.3.6.1.2.1.31.1.1.1.1.436207616
1.3.6.1.2.1.31.1.1.1.1.436208128
1.3.6.1.2.1.31.1.1.1.1.436208640
1.3.6.1.2.1.31.1.1.1.1.436209152
1.3.6.1.2.1.31.1.1.1.1.436209664
1.3.6.1.2.1.31.1.1.1.1.436210176
Zabbix 192.0.2.1 getBulkRequest
1.3.6.1.2.1.31.1.1.1.1.436210176
192.0.2.1 Zabbix get-response
1.3.6.1.2.1.31.1.1.1.1.436210688
1.3.6.1.2.1.31.1.1.1.1.436211200
1.3.6.1.2.1.31.1.1.1.1.436211712
1.3.6.1.2.1.31.1.1.1.1.436212224
1.3.6.1.2.1.31.1.1.1.1.436212736
1.3.6.1.2.1.31.1.1.1.1.436213248
1.3.6.1.2.1.31.1.1.1.1.436213760
1.3.6.1.2.1.31.1.1.1.1.436214272
1.3.6.1.2.1.31.1.1.1.1.436214784
1.3.6.1.2.1.31.1.1.1.1.436215296
Upgrade your templates in Zabbix
In this post, we have seen that to retrieve the OID tree consisting of all the interface names from 192.0.2.1; snmpwalk
required 10 times the amount of packets to achieve the same result as snmpbulkwalk
:
Zabbix 6.0 – snmpwalk | Zabbix 7.0 – snmpbulkwalk |
20 x get-next-request pakets | 2 x getBulkRequest packets |
20 x get-response packets | 2 x get-response packets |
I therefore highly recommend upgrading your existing SNMP templates in Zabbix, or doing a rewrite of your own templates, so that you can take advantage of SNMP GETBULK for low-level discovery.
Here is an example of a template utilizing snmpbulkwalk
in Zabbix 7.0: OSPF by SNMP.
Leave a Reply