Skip to content

Configuring SNMP on Linux

The best way to monitor a Linux server or workstation (Red Hat, Fedora, Debian, Ubuntu, Mint, CentOS, Rocky Linux, Suse, OpenSuse… practically any Linux distribution) is through SNMP. This tutorial aims to install the snmpd service and perform a basic configuration of the service to make the information available to Monsta.

Logged in as root, on the Linux terminal type:

Terminal window
yum install net-snmp

Logged in as root, on the Linux terminal type:

Terminal window
apt-get install snmpd

In general, the snmpd.conf file is located in /etc/snmp/. Make a backup of the original file:

Terminal window
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.old

Edit the new file (example with vim: vim /etc/snmp/snmpd.conf) according to the lines below:

Terminal window
rocommunity public
sysLocation “Localização deste servidor”
sysContact seu@email.com.br

On the terminal, type:

Terminal window
systemctl restart snmpd
systemctl enable snmpd

On the terminal, type:

Terminal window
service snmpd restart

Allow the SNMP service in the Linux firewall

Section titled “Allow the SNMP service in the Linux firewall”

If the Linux server or workstation you want to monitor has a firewall enabled, to access the SNMP service add the example below to this device’s firewall rules. If your distribution manages the firewall differently, open the incoming UDP/161 port.

Terminal window
firewall-cmd --permanent --zone=public --add-port=161/udp
systemctl restart firewalld