Packetwatch.net

Net-SNMP in Red Hat Enterprise Linux



Last modified: Nov. 14, 2008

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


1 - Summary

This guide will show you how to install net-snmp in Red Hat Enterprise Linux.
This has been tested in Red Hat Enterprise Linux 5.


2 - Net-SNMP installation

Install the following Red Hat packages in order.
# sudo rpm -ivh net-snmp-libs-*.rpm
# sudo rpm -ivh lm_sensors-*.rpm
# sudo rpm -ivh net-snmp-*.rpm
# sudo rpm -ivh net-snmp-utils-*.rpm


3 - Service configuration

Find where the net-snmp daemon was installed to.
# rpm -ql net-snmp-* | grep sbin
/usr/sbin/snmpd
/usr/sbin/snmptrapd

Enable the net-snmp service so that it will start when the system starts up.
# /sbin/chkconfig snmpd on
# /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 snmpd.conf /etc/rc.d/init.d/snmpd 
# config: /etc/snmp/snmpd.conf
# config: /usr/share/snmp/snmpd.conf
# strings /usr/sbin/snmpd | grep snmpd.conf

You can create your own configuration file. Here is a simple example.

  rocommunity public 127.0.0.1

# rpm -ql net-snmp-* | grep snmpd.conf
/etc/snmp/snmpd.conf
/usr/share/man/man5/snmpd.conf.5.gz
# 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 sestatus | grep status:
SELinux status:                 enabled

Start the net-snmp service.
# sudo /sbin/service snmpd start
Starting snmpd: [  OK  ]
# sudo cat /var/run/snmpd.pid
5772


4 - Snmpget example

Run snmpget to get an SNMP value. This example displays the system
description.
# snmpget -c public -OQ -Os -Ov -v 2c localhost sysDescr.0
Linux server.test.com 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:12 EDT 2008 i686


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 net-snmp running in Red Hat
Enterprise Linux.
# sudo /sbin/shutdown -r now
# sudo /sbin/service snmpd status
snmpd (pid 4532) is running...


Last modified: Thu Jan 1 12:00:00 1970 NZST
Packetwatch Research 2002-2010.