MRTG (The Multi Router Traffic Grapher) is a very cool application. It runs on Linux, OS X and also under Windows (with Perl support) and it can draw graphs about everything (everything that support SNMP). I use this piece of software to monitor network interfaces and of course routers.
With Cisco routers you need to enable the SNMP support under the CLI. So, after the telnet connection, become “superuser” (the enable command) and create the SNMP community:
router# configure terminal
router(config)# snmp-server community CommunityName RO
PS: if you get MRTG working, you can run also the command wr memory to save the router config so you can reboot the device without loosing settings:
router# wr memory
Now, under your Linux system (on the others systems these steps may be similar…) you need only to install with your favorite package manager the MRTG package. After becoming root as usual (with su or sudo -s) run this command (create before the dir /var/www/html/mrtg and /etc/mrtg):
linux@host# cfgmaker –global ‘WorkDir: /var/www/html/mrtg’
–output /etc/mrtg/mrtg.cfg CommunityName@192.168.0.254
You can now run the mrtg program with the config file as option:
linux@host# mrtg /etc/mrtg/mrtg.cfg
Now your router traffic will be graphed! (check http://your_linux_server/mrtg/)
Is a good idea to create a cron job to update the graph every five minutes. Create a file into /etc/cron.d named mrtg.cron with this content:
0-59/5 * * * * root /usr/bin/mrtg /etc/mrtg/mrtg.cfg
PS: Into this little tutorial I suppose the presence of a running Linux server with apache installed and a Cisco router with the private address 192.168.0.254. Also all programs path may change due to your system/distro…
I don’t cover all possible security improvements (like protect your router from Internet, setting htaccess password to your web server, etc…). But remember always to check twice all your potential security issues.