SNMP in Red Hat Enterprise Linux

Last modified: Nov. 5, 2010

1 - Summary
2 - Net-SNMP installation
3 - Service configuration
4 - Snmpget example
5 - Service check

1 - Summary

This guide will show how to install SNMP in Red Hat Enterprise Linux. SNMP is a
network protocol used to monitor network devices. We will install Net-SNMP.
This has been test in Red Hat Enterprise Linux 4 and 5.

2 - Net-SNMP installation

Install the net-snmp package.
# sudo yum install net-snmp

3 - Service configuration

Find where the net-snmp daemon was installed to.
# rpm -ql net-snmp-* | grep sbin
# rpm -ql net-snmp-* | grep rc.d

Enable the net-snmp service so that it will start when the system starts up.
# sudo /sbin/chkconfig snmpd on
# sudo /sbin/chkconfig --list snmpd
snmpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off

Find where the configuration file should be put.
# grep .conf /etc/rc.d/init.d/snmpd
# chkconfig: - 50 50
# config: /etc/snmp/snmpd.conf
# config: /usr/share/snmp/snmpd.conf
if [ -e /etc/sysconfig/snmpd.options ]; then
  . /etc/sysconfig/snmpd.options
# strings /usr/sbin/snmpd | grep .conf
Reconfiguring daemon
  -c FILE[,...]         read FILE(s) as configuration file(s)
  -C                    do not read the default configuration files
  -H                    display configuration file directives understood

You can create your own configuration file. For this example, we will use a
read only community name of public.
  rocommunity public
  syslocation "Test"
  syscontact "John Doe"
# rpm -ql net-snmp-* | grep snmpd.conf
# sudo cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.example
# sudo vi /etc/snmp/snmpd.conf

You will need to configure SELinux appropriately. SELinux status can be
found by running sestatus.
# sudo /usr/sbin/sestatus | grep status:
SELinux status:                 enabled

Before starting the service, make sure that udp port 161 is open in case you
are running firewall software. Here is a sample rule.
  -A RH-Firewall-1-INPUT -p udp -m udp --dport 161 -j ACCEPT
# sudo /sbin/service iptables stop
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
# sudo cp /etc/sysconfig/iptables /etc/sysconfig/iptables.previous
# sudo vi /etc/sysconfig/iptables
# sudo /sbin/service iptables start
Applying iptables firewall rules:                          [  OK  ]
Loading additional iptables modules: ip_conntrack_netbios_n[  OK  ]

If you installing this on a Dell PowerEdge server that already has Dell
OpenMange Server Administrator installed, run the following to enable SNMP in
OpenManage Server Administrator. This will add a line in the net-snmp config
file to allow more information to be monitored.
# sudo /etc/init.d/dataeng enablesnmp
Data Engine SNMP enabled

Start the net-snmp service.
# sudo /sbin/service snmpd start
Starting snmpd:                                            [  OK  ]
# sudo /sbin/service snmpd status
snmpd (pid  3280) is running...

If you are on a Dell PowerEdge server that already has Dell OpenManage Server
Administrator installed, restart the OpenManage sevices. It will complain about
the dsm_sa_snmpd service because it wasn't already running.
# sudo /etc/init.d/dataeng restart
Stopping Systems Management Data Engine:
Stopping dsm_sa_snmpd: Not started                         [FAILED]
Stopping dsm_sa_eventmgrd:                                 [  OK  ]
Stopping dsm_sa_datamgrd:                                  [  OK  ]
Starting Systems Management Data Engine:
Starting dsm_sa_datamgrd:                                  [  OK  ]
Starting dsm_sa_eventmgrd:                                 [  OK  ]
Starting dsm_sa_snmpd:                                     [  OK  ]
# sudo /opt/dell/srvadmin/sbin/ status
Remote Access Controller (RAC4) is stopped                 [  OK  ]
dell_rbu (module) is running
ipmi driver is running
dsm_sa_datamgrd (pid 3677) is running
dsm_sa_eventmgrd (pid 3953) is running
dsm_sa_snmpd (pid 4013) is running
dsm_om_shrsvcd (pid 3210) is running
dsm_om_connsvcd (pid 4444 4443) is running

4 - Snmpget example

If you are running this against a Dell PowerEdge server you can get more
information if you download the MIBs for PowerEdge servers at the Dell
website. You have to go to and go under the Systems
Management section. Download the file that says MIBs for PowerEdge. The MIB
files will need to be moved to the computer that is running snmpget. In our
example, we are running snmpget from a FreeBSD computer. Find where MIB files
are stored and copy the files to that directory. Afterwards, run snmpget.
# pkg_info -L net-snmp-* | grep /mibs/
# sudo chown root:wheel ~/dell_mib/mibs63/*
# sudo cp ~/dell_mib/mibs63/* /usr/local/share/snmp/mibs/

From another computer, run snmpget to view some SNMP information.
# sudo snmpget -Os -c public -v 2c sysName.0 sysLocation.0 sysContact.0
sysName.0 = STRING:
sysLocation.0 = STRING: "Test"
sysContact.0 = STRING: "John Doe"

5 - Service check

Reboot your computer. Log in like normal and check to see that the net-snmp
service is running. That's it, now you have snmp running in Red Hat Enterprise
# sudo /sbin/shutdown -r now
# sudo /sbin/service snmpd status
snmpd (pid  2339) is running...

Last modified: Thu Jan 1 00:00:00 1970 UTC
Packetwatch Research 2002-2024.