The Multi Router Traffic Grapher (MRTG) is a network or resource monitoring tool used by System Administrators across the Globe. MRTG generates HTML pages containing PNG images, which provides a real time visual representation of network traffic and system resources. |
STEP 1: Install MRTG with required packages |
# yum install mrtg net-snmp net-snmp-utils -y |
STEP 2: Configure snmpd |
If you need to monitor localhost including interface and other stuff such as CPU, memory etc, configure snmpd. Open /etc/snmp/snmpd.conf, |
# vim /etc/snmp/snmpd.conf |
Do changes in it as follows to only allow access from localhost: |
com2sec local localhost public |
group rwroup v1 local |
group rwgroup v2c local |
group rwgroup usm local |
view all included .1 80 |
access rwgroup “” any noauth exact all all none |
syslocation BSNL, India |
syscontact Root |
Save and close the file. Restart snmpd: |
# chkconfig snmpd on; service snmpd restart |
Make sure you see interface IP, by running the following command: |
# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex |
Sample Outputs: |
IP-MIB::ipAdEntIfIndex.121.xx.yy.zzz = INTEGER: 2 |
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1 |
STEP 3: Configure MRTG, |
Use cfgmaker command to creates /etc/mrtg/mrtg.cfg file, enter: |
# cfgmaker –global ‘WorkDir: /var/www/mrtg’ –output /etc/mrtg/mrtg.cfg public@localhost
|
Options Description: |
|
|
|
Finally, run indexmaker to create web pages which display the status of an array of mrtg interface status pages: |
# indexmaker –output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg |
STEP 4: Verify Cron Job |
# cat /etc/cron.d/mrtg
|
*/5 * * * * LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg –lock-file /var/lock/mrtg/mrtg_l –confcache-file /var/lib/mrtg/mrtg.ok |
Now, restart crond service to make it live instantly. |
# chkconfig crond on; service crond restart |
STEP 5: To view graph, |
You need Apache web server to view graphs, simply type the following to install httpd: |
# yum install httpd
|
# chkconfig httpd on ; service httpd start
|
Now, open http://bubu-online.blogspot.com/mrtg/ . Use your server name instead of bubu-online.blogspot.com. |
Sunday, June 24, 2012
Multi Router Traffic Grapher – MRTG on Linux
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment