Thursday, September 6, 2007

MRTG graph creation with Cisco routers

MRTG graph creation routers and devices

From my recent blog entry of MRTG install howtos, which can be found here. Here is another entry to cover several steps on creating MRTG graph against Cisco router's ethernet and serial interfaces.

This blog entry assumes that your routers support SNMP or SNMP-enabled by configuration setup. The steps that will be taken here works perfectly with all the cisco routers currently scatterred around me. This blog entry hopes that the steps that would be covered here would also work with your non-cisco routers too. Assumming here also that this MRTG package is currently installed
from your box as well. If not, just follow the recent entry posted here.

Here is how to create and generate graph for Cisco interfaces.

Simply issue

# cfgmaker community@cisco-router-ip-address

# cfgmaker public@ --output=cisco.cfg

The above command creates MRTG config file cisco.cfg and polls Cisco router's IP for SNMP-enabled interface. The above command uses a default IPv4 polling with no special MRTG parameters and special output file format specified. Similarly, this MRTG command should work just fine with different distros.

Detail steps on enabling your router to support SNMP and configure them to have read-only community type would not be covered here. For security reasons, make sure your community name is a read-only community type.

Now an exact command that would do same function but with filters to remove all lines that starts with # character (commented lines) and all empty lines using grep would be like so

# cfgmaker public@ | grep -v '#\|^$' > cisco.cfg

Similar output would be like so
Target[]: 1:public@
SetEnv[]: MRTG_INT_IP=""
MaxBytes[]: 12500000
Title[]: Traffic Analysis for 1 -- core_link2
Max Speed:
12.5 MBytes/s
Ip: ()
Target[]: 2:public@
SetEnv[]: MRTG_INT_IP=""
MaxBytes[]: 12500000
Title[]: Traffic Analysis for 2 -- core_link2
PageTop[]: Traffic Analysis for 2 -- core_link2

The above command would simply display SNMP polling resulting lines from the polled cisco router. If ethernet and and serial interfaces exist from the SNMP-enabled cisco routers, MRTG should give the resulting MRTG config lines.

Now, the next thing to do is to create MRTG index.html page using MRTG indexmaker binary tool. If you have an existing MRTG index.html file, you can simply copy and paste the needed portion of this new index.html file our output the file on a different file name like so

# indexmaker cisco.cfg --output=device.html

The file device.html is the equivalent browseable MRTG page for cisco.cfg.

It is done. The command is also basic to other devices that needs to be polled.

Most opensourced and linux packages are simple and handy.

MRTG is so nice creating highly configurable MRTG usage graphs, that so far it also works great with these boxes, as I expected, with Cisco 16xx, 17xx, 26xx, 36xx, 50xx, AS53xx, MC38xx routers, Cisco 26xx/16xx switches, Cisco PIX 50X firewalls, Cisco Content Engine box, Cisco ATA boxes, SkyStream DVB 16xx/55xx routers, Huwei Quidway 16xx routers, Planet wireless boxes, Senao wireless boxes, DLink/LinkSys wireless routers/switches, IDirect modem routers, SysMaster boxes, NetEnforcer Allot AC-20X/40X boxes, Packeteer box, HP/Compaq/Dell Gigabit ethernet interfaces, VYYO wireless modems, IP Planets, and even Quintum PABX box too! Most probably, it should work out fine with other boxes too.

Do let me know if MRTG did not work properly with these boxes from your side. I hope MRTG works with these black rounded boxes around too.

All products and other commercial boxes mentioned here are all propriety trademarks and products managed by their own companies. They were mentioned here for my own personal MRTG reference alone and does not guarantee MRTG would work perfectly with the others. You may need to check their own site for proper and more detailed SNMP documentation of their own respective boxes.

See sample screenshots


HowlingMad said...

From my recent blog entry of MRTG install howtos, which can be found here.

When I tried to access this link I received a google error.

Thanks, Bob

VeRTiTO said...

oh. thanks for dropping by, here'sthe link

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy