Let’s look into other interfaces. Sometimes you will need to monitor something that doesn’t work with an agent: printer, router, etc. SNMP can help you with that.
First, you will need is to find the variable’s OID (Object Identifier) the numeric code that will help the server to request the specific things we will monitor.
To do so you can look it up in the device's manual or discover it with snmpwalk utility or use any MIB browser you like. For this article we will look into using snmpwalk.
Let's look into getting OIDs with snmpwalk.
Install the SNMP package: you'll need to install the SNMP package. On Debian-based systems, you can install it with:
sudo apt-get install snmp
On Red Hat-based systems, you can use:
sudo yum install net-snmp
On Windows system, you can use the Net-SNMP package for Windows, which is available at Net-SNMP website (https://www.net-snmp.org/download.html).
Check the IP address or hostname of the device you want to query, as well as the SNMP version this device supports (usually SNMPv1 or SNMPv2c).
You'll also need to find out the SNMP community for the device. This works like a password that allows to access the SNMP data on this host. You should be able to find this in the device's documentation or configuration, the usual default option is ‘public’.
If you learned the OID you need from manual, run the snmpwalk command to check if everything's fine. The basic syntax for snmpwalk is the same on Windows as on Linux or Unix:
snmpwalk -v [SNMP version] -c [community string] [device IP/hostname] [OID or MIB name]
snmpwalk -v2c -c public 192.168.1.1 .220.127.116.11.18.104.22.168.0
Here, the OID .22.214.171.124.126.96.36.199.0 specifies the hostname, and the snmpwalk command will return the MIB name along with the current value and the variable type.
To discover an OID with snmpwalk you could run it without an OID or MIB name to search the one you interested in manually.
After finding out its name run the same command adding - On
Note that some variables have more than one port the last number in OID shows this port.
Next, we will need to add a host with an SNMP interface configured and enter your device’s IP, SNMP version, and SNMP community. SNMP templates can be handy, but compatibility is not granted. Otherwise it’s a usual host creation.
The only thing left is to create an SNMP item: Go to Configuration > Hosts and click on the device you want to monitor. Go to the Items tab and click on the "Create item" button. Fill in the necessary information: item name, type (for our example, SNMPv2 agent), information type, and OID. Fill the Key line with OID number.
Press test to see if it works.
Once everything is set up, you should start seeing data from the device in Zabbix. You can use Zabbix's graphs, triggers, and other features to monitor the device and be alerted if there are any issues.
We learned how to get the OIDs we need, and how to create SNMP hosts and items to monitor them with Zabbix.