I’m finally getting round to monitoring what’s going on with various network devices. I have been meaning to setup an MRTG / SNMP setup for a while now. It’s actually very easy with the following steps from the Ubuntu wiki:
sudo apt-get install snmpd
sudo apt-get install mrtg
Now that mrtg is installed, we must create a home where web pages related to the program can reside. The Ubuntu / apache2 default is /var/www/.
sudo mkdir /var/www/mrtg
Backup the original /etc/mrtg.cfg file:
sudo cp /etc/mrtg.cfg /etc/mrtg.cfg.ORIGINAL
Create a configuration file for MRTG:
cfgmaker snmp_community_string@ip_address_of_device_to_be_monitored > /etc/mrtg.cfg
Create and index file for the webserver :
indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html
Wait about 5 minutes before browsing to:
http://server_ip/mrtg/index.html
I also repeated the above steps for each of my SNMP enabled devices, writing to a new config file each time.
I then made a new entry at .etc.cron.d/ for the mrtg process to run each 5 minutes for each new config file.
The stats can be seen here.