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.
Installation
Section titled “Installation”Systems using yum
Section titled “Systems using yum”Logged in as root, on the Linux terminal type:
yum install net-snmpSystems using apt-get
Section titled “Systems using apt-get”Logged in as root, on the Linux terminal type:
apt-get install snmpdConfiguring the snmpd.conf file
Section titled “Configuring the snmpd.conf file”In general, the snmpd.conf file is located in /etc/snmp/. Make a backup of the original file:
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.oldEdit the new file (example with vim: vim /etc/snmp/snmpd.conf) according to the lines below:
rocommunity publicsysLocation “Localização deste servidor”sysContact seu@email.com.brRestart and enable the SNMP service
Section titled “Restart and enable the SNMP service”Systems with Systemd
Section titled “Systems with Systemd”On the terminal, type:
systemctl restart snmpdsystemctl enable snmpdSystems with Systemv
Section titled “Systems with Systemv”On the terminal, type:
service snmpd restartAllow 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.
firewall-cmd --permanent --zone=public --add-port=161/udpsystemctl restart firewalld