Wednesday 29 August 2007

Monitor your adsl bandwith usage

I use fedora 6, mrtg and snmp tools to monitor adsl router bandwith for all interfaces (wlan,atm,lan)

install packages:
net-snmp
net-snmp-utils
mrtg
You can install yum install packagename. Or download package and rpm -ivh package name.

configure mrtg:
for snmp v1:
cfgmaker --output=/etc/mrtg/mrtg.cfg --global \
"workdir: /var/www/mrtg" -ifref=ip \
--global 'options[_]: growright,bits' public@192.168.2.1
for snmp v2:

cfgmaker --output=/etc/mrtg/192.168.2.1.cfg \
-ifref=ip --global "workdir: /var/www/mrtg" \
--snmp-options=:::::2 public@192.168.2.1



for public@192.168.2.1 use your snmp community and your adsl router ip address.
check your /etc/mrtg/mrtg.cfg and comment out interfaces you want to monitor.

run this command three times to collect data. You will get error for the first two times.
env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg

make your html page:
indexmaker --output=/var/www/mrtg/index.html \
/etc/mrtg/mrtg.cfg

put configuration to crontab:
0-59/5 * * * * root env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg

httpd configuration:
edit configuration /etc/httpd/conf.d/mrtg.conf and comment deny restrictions if you want to access your http service remotely.
then start service
service httpd start

enable this service
chkconfig httpd on

access your mrtg page http://yourmachineipadressorhostname/mrtg/

No comments: