Setting up SNMP (Simple Network Management Protocol) on a CentOS machine is a very quick and easy process.
First we will install SNMP itself by running the following command:
yum install net-snmp
Once you have SNMP installed we will want to install the configuration utility for SNMP. The configuration utility allows you to easily configure SNMP for both the community string, SNMP version and basic security.
yum install net-snmp-utils
Once you have the configuration tool installed you will be ready to 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 monitoring setup you will need to choose the options that work for you.
Once done, you will need to copy your newly made configuration file to the correct directory. In most cases you will need to move it from “/root/snmpd.conf” to “/etc/snmp/snmpd.conf” – You will need to overwrite the existing conf file in the /etc/snmp/ directory.
Command to do the above:
mv /root/snmpd.conf /etc/snmp/
Once you have moved your configuration file over you will be ready to restart SNMP.
service snmpd restart
The last thing you may want to do (optional) is to have SNMP start with the server 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 to go, however if you are running a firewall on the server you will need to open port 161 for UDP & TCP traffic to allow SNMP to be accessed from your remote monitor.
Originally posted 2016-01-18 16:36:44.