This guide explains how to install SNMP on CentOS.
Install the libraries:
yum install net-snmp
Later in this procedure we refer to snmpwalk. If you want to follow that part of the tutorial, install this too:
yum install net-snmp-utils
By default the service won’t be started. You can check it and then start it:
service snmpd status service snmpd start
The baseline smtpd.conf has too much information. You probably only want to read the public community and not the entire manual so let’s backup the config file and do a one liner:
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.backup vi /etc/snmp/snmpd.conf
Add just this line:
Restart the service:
service snmpd restart
Checking the Service
The snmpwalk utility can be used to see if the SNMP service is operational.
Often systems are checked from remote locations, which is also a good way to see if the firewall access is correct.
Here is an example test:
snmpwalk -c secret_password -v1 www.hostname.com
161 so make sure this is open on your firewall.
If you’re using WHM/cPanel, add the remote IP address of your testing server like below:
csf -a 18.104.22.168
Automatic Restart after Server Reboot
SNMP has a habit of not starting up after a server is shutdown. Avoid that by doing the command below:
chkconfig snmpd on
The output of
Created symlink from /etc/systemd/system/multi-user.target.wants/snmpd.service to /usr/lib/systemd/system/snmpd.service.
Troubleshooting SNMP can be a complete nightmare. The configuration files are huge and when you’re dealing with something like SNMP version 3 the options enormous. The default SNMP configuration file supplied with some systems is totally overwhelming.
But if you understand firewall theory and troubleshooting firewall issues, and if your using
snmpwalk to troubleshoot, you’ll get far. Otherwise refer to the first two references listed below:
snmpwalk: No securityName specified
Add -v2c to test, e.g.
snmpwalk -c secret localhost -v2c
This article was updated to remove the reference to
net-snmp-utils as it’s not needed for a baseline install.