Setting up SNMP (Simple Network Management Protocol) on a CentOS machine is a very quick and easy process and I often forget so here’s a quickie on how.
Install the SNMP daemon by running the following command:
yum install net-snmp
Once SNMP is installed you want to install the configuration utility. I always forget this. It makes it easy to configure SNMP for both the community string, SNMP version and basic security.
yum install net-snmp-utils
Once the configuration tool is installed, run it:
snmpconf -g basic_setup
As you run through the configuration utility it will present you with many options. Depending on how you have your remote monitoring setup (Cacti/Nagios) you will need to choose the options that work for you.
Once done, you will need to copy the configuration file to the correct directory. In most cases it will need to be moved from “/root/snmpd.conf” to “/etc/snmp/snmpd.conf” – You will need to overwrite the existing conf file in the /etc/snmp/ directory.
mv /root/snmpd.conf /etc/snmp/
Once the configuration file has been moved over you can restart SNMP.
service snmpd restart
The last thing you need to do is have SNMP start at boot time. If you do not run the following command you will need to manually start SNMP after a reboot.
chkconfig snmpd on
At this point you should be set. If for some reason you are running the firewall will need to open port 161 for UDP & TCP traffic to allow SNMP to be accessed remotely.