Setup SNMP Hosts in Zabbix
In this next few lectures we will look at SNMP
SNMP stands for Simple Network Management Protocol.
Common devices that support SNMP are routers, switches, printers, servers, workstations and other devices found on IP networks.
Not every network device supports SNMP, or has it enabled, and there is a good chance you don't have an SNMP enabled device available that you can use in this lecture.
So, in this next few lectures, I will demonstrate setting up SNMP on several different operating systems and also on a Cisco switch.
We will set up Zabbix to query using OIDs first. We will manually create a few sample SNMP items. Then demonstrate setup and querying with MIB descriptions. MIB stands for Management Information Base. And then use LLD to discover new SNMP devices and automatically configure them in Zabbix. And also automatically create templates for a device from the available SNMP responses.
I SSH onto a server, I will use my new Grafana server, which is an Ubuntu 18, and then I install the SNMP daemon.
sudo apt install snmpd
I then configure it and set the agent address and the community mycommunity
sudo nano /etc/snmp/snmpd.conf
... agentAddress udp:161 ... rocommunity mycommunity default -V systemonly rocommunity6 mycommunity default -V systemonly ...
The SNMP agent by default is only accessible by localhost. I have changed it to be accessible remotely, so I also add a firewall rule to block all IPs other than my Zabbix server.
iptables -A INPUT -p udp -s zabbix.seanwasere.com --dport 161 -j ACCEPT iptables -A INPUT -p udp -s localhost --dport 161 -j ACCEPT iptables -A INPUT -p udp --dport 161 -j DROP iptables -L
iptables settings will be lost in case of system reboot. You will need to reapply them manually,
sudo apt install iptables-persistent
This will save your settings into two files called,
Any changes you make to the iptables configuration won't be auto saved to these persistent files, so if you want to update these files with any changes, then use the commands,
iptables-save > /etc/iptables/rules.v4
iptables-save > /etc/iptables/rules.v6
I then SSH onto my Zabbix Server,
sudo apt install snmp
I can now query my grafana server using snmpwalk
snmpwalk -v 2c -c mycommunity grafana.seanwasere.com .
See the video on how I then setup the host configuration in Zabbix.
In the video, I also set up SNMPD on the Centos 7 VM.
To install SNMPD on centos 7,
sudo yum install net-snmp net-snmp-utils systemctl enable snmpd
See the video for how I configure the /etc/snmp/snmpd.conf file.
On the Centos 7 VM, I also needed to allow connections for UPD 161.
firewall-cmd --permanent --add-port=161/udp firewall-cmd --reload firewall-cmd --list-ports