SNMP - How to Set Up

Setting up SNMP on a RedHat 5 server

There are times when a customer would like to use their own services to monitor the Linux servers (disk space, temperature, etc). Setting this up is very easy. To do this, we can set up SNMP (Simple Network Management Protocol) for them, and they can then configure the conf file later. This process is not service affecting. This document assumes basic knowledge of the vi editor.

Topic / Solution

All of these steps need to be run as root (or someone with super user access).

∙ First check to see if snmp is already installed.

rpm -qa | grep snmp

(you should get back a regular entry and the libs entry).

∙ If not, install it from the repository.
yum install -y net-snmp

∙ If the customer has already given you the community name (the default is "public"), edit the configuration file to change it. If they haven't given you any information, skip this part.
vi /etc/snmp/snmpd.conf

Change "public" to whatever was given.

Save and exit.

∙ If the firewall is turned on, set up ports 161 and 162 for this service. If not, skip this part.

vi /etc/sysconfig/iptables

Add the following lines (change the xx.xx.xx.xx to the IP address they'll be connecting from).

∙ Edit the service files so they start at the correct levels.
vi /etc/init.d/snmpd

Change# chkconfig: - 50 50
to# chkconfig: 2345 50 50

Save and exit.

vi /etc/init.d/snmptrapd

Change# chkconfig: - 50 50
to# chkconfig: 2345 50 50

Save and exit.

∙ Install the services (you can also do this via chkconfig --add <service name>).

chkconfig snmpd on
chkconfig snmptrapd on

∙ Check to make sure they're installed and set to on.

chkconfig --list | grep snmp

∙ Start the services.

service snmpd start
service snmptrapd start

∙ Repeat the above steps for all servers requested.

The customer is then welcome to change any of those other values they'd like (or add their own conf file in its place, as long as it's compatible), and then restart the snmp services once the changes are made. This process is not service affecting.