Thursday, June 20, 2013

How to install and configure SNMP on Ubuntu and Centos

1.Installation

  • Ubuntu - root@linux:~# sudo apt-get install snmpd

  • Centos - root@linux:~# yum install net-snmp net-snmp-utils

2. Configuration - /etc/snmp/snmpd.conf
Move existing /etc/snmp/snmpd.conf configuration file to /etc/snmp/snmpd.conf.org
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.org
Create a new /etc/snmp/snmpd.conf file:
rocommunity public
syslocation "PDC, DataCenter"
syscontact abc@com.my

3. Configuration - 
/etc/default/snmpd(ubuntu)
/etc/sysconfig/snmpd(centos)

Make snmpd use the newly created file and make it listen to all interfaces:

Edit /etc/default/snmpd or /etc/sysconfig/snmpd

Change from:
# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
To:
# snmpd options (use syslog, close stdin/out/err).
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf'
and restart snmpd
/etc/init.d/snmpd restart

4. Test

Do a snmpwalk from another host against your newly configured host.
# snmpwalk -v 1 -c public -O e localhost

source :

Related Posts:

0 comments:

Post a Comment