Saturday, April 16, 2011

Install and Test SNMP on CentOS 5.5

1. Install net-net-snmp and net-snmp-utils
# yum install net-snmp-utils

2. Create /etc/snmp/snmpd.conf. Following is a very simple example for the testing.

rocommunity public
syslocation "ABC, ABC Inc."
syscontact me@abc.com

3. Startup snmpd server
# /etc/init.c/snmpd start

4. Ues snmpwalk to test SNMP setup.
# snmpwalk -v 1 -c public -O e 127.0.0

Or
# snmpwalk -v 1 -c public localhost system

If something similar to the following show up on the screen, the SNMP is working.

SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.localdomain 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:35 EDT 2010 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (977) 0:00:09.77
SNMPv2-MIB::sysContact.0 = STRING: me@abc.com
SNMPv2-MIB::sysName.0 = STRING: localhost.localdomain
SNMPv2-MIB::sysLocation.0 = STRING: "ABC, ABC Inc."
...

5. If someting is wrong, check /etc/snmpd/snmpd.conf for error. Following commands can be used for troubleshooting as well. If everything is fine, then firewall settings should be checked.
# /etc/init.d/snmpd status
# snmpd -f -Le

6. Enable the snmpd starts up when the system reboot.
# chkconfig snmpd on

No comments: