MRTG, a tool to monitor your network
Based on work by falseneutral.
Originally by Knatterman.
Network traffic analysis with MRTG on Linkstation
This article describes the setup of mrtg http://people.ee.ethz.ch/~oetiker/webtools/mrtg/ It is assumed you do this on a debianized linkstation.
Ensure you have mrtg and snmpd (If you do not have them:)
apt-get install snmpd apt-get install mrtg
Move the original /etc/snmp/snmpd.conf to a save place, e.g.
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.original
Create a new snmpd.conf with the following content:
(This example creates a community named "test" for the SNMP Daemon)
com2sec local localhost test group MyROGroup v1 local group MyROGroup v2c local group MyROGroup usm local view all included .1 80 access MyROGroup "" any noauth exact all none none disk /usr disk /mnt
Restart the snmpd daemon
cfgmaker --global 'WorkDir: /var/www/apache2-default/mrtg/' --global 'Options[_]: bits,growright' --output /root/mrtg.cfg test@localhost
This will setup mrtg. The html files will be created in the directory /var/www/apache2-default/mrtg/. The config file for mrtg will be stored in the directory /root and is named as mrtg.conf
After the first & second start you will get messages like
Rateup WARNING: /usr/bin/rateup could not read the primary log file for localhost_2 Rateup WARNING: /usr/bin/rateup The backup log file for localhost_2 was invalid as well Rateup WARNING: /usr/bin/rateup Can't remove localhost_2.old updating log file Rateup WARNING: /usr/bin/rateup Can't rename localhost_2.log to localhost_2.old updating log file
The messages will disappear after the 3rd start
Automize the start
insert the line
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/bin/mrtg /root/mrtg.cfg
This will update your page every 5 Minutes
You can see your networktraffic if you have a look on /var/www/apache2-default/mrtg/localhost_2.html (or similar)
man mrtg man smnpd man snmpd.conf man crontab