How to set up SNMP monitoring (snmpd) on Ubuntu 12.04

 

This one caused a bit of hassle recently – a few online guides don’t seem to work with the current version of Ubuntu. We found that this works, at least in the ~10 or so servers we have tried so far:

 

sudo apt-get install snmpd

 

Back up your snmpd.conf file:

 

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

 

Create a new file:

 

sudo touch /etc/snmp/snmpd.conf

 

Edit with your chosen editor and put in the following:

 

rocommunity public

syslocation “Describe the server’s location”

syscontact [email protected]

 

Save and exit. Now edit the following file:

 

/etc/default/snmpd

 

Comment out the following line by putting a # before it:

 

SNMPDOPTS=’-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid’

 

On the next blank line add the following:

 

SNMPDOPTS=’-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf’

 

Save the file and restart the SNMP daemon:

 

sudo /etc/init.d/snmpd restart

 

Now you should be able to successfully snmpwalk locally and from machines on the local network.