Monday, July 29, 2013

Install and Configure SNMP on Ubuntu


Installation of SNMP service on Ubuntu  is little different in comparison to red-hat base systems. There are simple steps to install and configure but first important thing is which package is equivalent to which package in Debian Repository, there are two packages named snmp and snmpd. snmp is the client tools and snmpd is server.
so lets start the installation

sudo apt-get install snmpd snmp

Only by this snmp will be installed on the system, now its time to configure it.

Configuration
Now Rename the Original SNMPD configuration file

sudo mv /etc/snmp/snmpd.conf  /etc/snmp/snmpd.conf.org

then create new configuration file

sudo vim.tiny /etc/snmp/snmpd.conf

and copy this content to that file

rocommunity  public
syslocation  "India"
syscontact  dexterdgeek@gmail.com


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

Edit /etc/default/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

sudo /etc/init.d/snmpd restart


Test
Do a snmpwalk from another host against your newly configured host.

snmpwalk -v2c -c public 127.0.0.1

Yes it works!!

No comments:

Post a Comment