Wednesday 23 September 2009

Setting up SNMP

Systems tested; Ubuntu Hardy

install packages
apt-get install snmp snmpd

I'm not sure why there are two config files but there are and we have to edit both. The first file configures the daemon itself
vi /etc/default/snmpd

Ensure these two lines exist
SNMPDRUN=yes
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'

Change the localhost address on the 2nd line to the address of the interface you will listen on (remove it completely to listen on all interfaces)
The second file contains the snmp details such as access rights & community names
vi /etc/snmp/snmpd.conf

Find this section;
#       sec.name  source          community
com2sec paranoid default public
#com2sec readonly default public
#com2sec readwrite default private

and change it to;
#       sec.name  source          community
#com2sec paranoid default public
com2sec readonly default public
#com2sec readwrite default private

NOTE: Using the default community "public" is not recommended for security reasons. You should change it to a custom community name. It is left as default for simplicities sake. To change it just comment out all lines and add a new one. For example;
#       sec.name  source          community
#com2sec paranoid default public
#com2sec readonly default public
#com2sec readwrite default private
com2sec readonly default MyCommunity


Checking your configuration from the local host
snmpwalk -Os -c public -v 1 localhost system

This should return a bunch of lines relating to various parts of your system. You can execute the same command from another host (snmp package is required), changing "localhost" to the name of the system.

Sources:
http://www.debuntu.org/how-to-monitor-your-servers-with-snmp-and-cacti

No comments: