Setup SNMP Hosts in Zabbix

Video Lecture

Setup SNMP Hosts in Zabbix Setup SNMP Hosts in Zabbix Setup SNMP Hosts in Zabbix

Description

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.

So,

I SSH onto a server, I will use my new Grafana server, which is an Ubuntu 18, and then I install the SNMP daemon.

1
sudo apt install snmpd

I then configure it and set the agent address and the community mycommunity

1
sudo nano /etc/snmp/snmpd.conf
1
2
3
4
5
6
...
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.

1
2
3
4
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

Warning

iptables settings will be lost in case of system reboot. You will need to reapply them manually,

or

install iptables-persistent

sudo apt install iptables-persistent

This will save your settings into two files called,

/etc/iptables/rules.v4

/etc/iptables/rules.v6

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,

1
sudo apt install snmp

I can now query my grafana server using snmpwalk

1
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,

1
2
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.

1
2
3
firewall-cmd --permanent --add-port=161/usp
firewall-cmd --reload
firewall-cmd --list-ports