Using MRTG with Linksy Routers
How to setup MRTG to graph statistics from Linksys routers
#####Props to Mathew Atkins who did the orginal write up and collector.pl script.
I just edited it to suit my needs.#####
http://www.akins.org/matthew/linksys.html
Requirements
Procedures
Installation
- Install NetSNMP.
- Install MRTG.
- Copy the Perl Scriptcollector.pl to
/usr/local/bin/collector.pl and chmod 755
Configuration
- Enable SNMP Logging in the router by navigating to the Log Section and placing
the IP address of your Linux server as the logging destitation.
- Edit /etc/snmp/snmptrapd.conf and place the following entry:
NOTE: You may need to create this file
traphandle default /usr/local/bin/collector.pl
-
Edit your mrtg.cfg with the following entry to monitor Traffic on the Router
#################################
# GLOBAL #
#################################
WorkDir: /var/www/html/mrtg
#################################
# Linksys Roouter #
#################################
WriteExpires: Yes
Title[^]: Traffic Analysis for
Title[router]: Linksys Router
PageTop[router]:Linksys Firewall/Router
Target[router]: `cat /tmp/router.out`
MaxBytes[router]: 187000
Configuration Test
Finishing touches
- Start the snptrapd daemon and set it so it starts on boot.
I use the following bash script in /etc/init.d and is called by rc*.d files
#!/bin/bash
/usr/sbin/snmptrapd -d -O T
- Add mrtg to roots crontab so that it runs every five.
Notice how mrtg logs to the mrtg.log file
#Added for MRTG
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/mrtg-2/bin/mrtg
/var/www/html/mrtg/mrtg.cfg --logging /var/log/mrtg.log #1>/dev/null 2>/dev/null
- Now you should be able to browse to your server and see the MRTG graphs.
With a little web surfing, you should see some results in 10 to 15 minutes.
MRTG Graphs for Linksys Cable/DSL Router
|