Set up a Network Discovery Rule and Action to Auto Configure SNMP Devices
I set up Network Discovery Rule to find SNMP devices on my local network and then add them as a host using a Discovery Action
On my network, I have a TP-Link SNMP router and Cisco Switch.
They will both be discovered, and I will auto assign the Generic SNMP template.
I will use my Raspberry Pi, which is configured as my Zabbix proxy, to scan the local network for any SNMP devices listening on port 161.
I have preconfigured both my SNMP devices to use the
mycommunity community and are sure that they respond to SNMP requests.
From my Raspberry Pi, I have pre-installed the SNMP tools,
sudo apt install snmp
and can use
snmpget to test both devices respond with the system description.
snmpget -v2c -cmycommunity <hostname or ip> 188.8.131.52.184.108.40.206.0
To begin configuration in Zabbix,
I create a new Discovery Rule,
- Name : SNMP Discovery
- Discovery by proxy : RaspberryPi
- IP Range : 192.168.1.0/24
- Checks :
- Check Type : SNMPv2 agent
- Port Range : 161
- SNMP Community : mycommunity
- OID : 220.127.116.11.18.104.22.168.0
- Device Uniqueness : IP Address
- Host name : DNS Address
- Visible Name : Host name
Then I create a Discovery Action to add each SNMP host
- Name : Add SNMP Host
- Discovery rule equals SNMP Discovery
- Add to host groups: Templates/Network Devices
- Link to templates: Generic SNMP
If you want, you can watch the scan progress from the Zabbix proxy by using the TCPDump command.
You may need to install TCPDump first.
sudo apt install tcpdump
The TCPDump command to watch the SNMP requests from the Zabbix proxy is
sudo tcpdump -n -s0 port 161 and udp
The scan progress can be quite slow and unpredictable when it will start/finish. Leave it running and come back in 24 hours.
Once I am happy that all the SNMP devices have been discovered and added, I then disable the Discovery rule so that I don't get any duplicate hosts added due to me changing the host names in the Zabbix UI configuration.