Friday, March 21, 2014

Setup SNMP On A Linux Host

This article will cover the basic setup of SNMP on a Linux host. Typically I enable this service to monitor the performance of a Linux host using Cacti.

First we install the SNMP daemon and SNMP tools:
sudo apt-get install snmp snmpd
Next we take a backup of the default SNMP daemon configs:
sudo mv /etc/snmp/snmpd.conf  /etc/snmp/snmpd.conf.old

Then we create a new daemon config:
sudo nano /etc/snmp/snmpd.conf

In the config file add the following information:
rocommunity  public
syslocation  "Data Center Location"
syscontact  Sysadmin@email.com


Next we update the daemon to use this snmpd.conf file:
sudo nano /etc/default/snmpd

Replace the following line:
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'

With:
#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'


Now restart the SNMP daemon to reload the settings:
sudo service snmpd restart

Basic SNMP V1 is now running. To test that SNMP is responding run the following command from the Linux host:
snmpwalk -v 1 -c public localhost

No comments:

Post a Comment