Saturday, December 5, 2009

Setting up MRTG on a managed switch (ex: on a SMC8024L switch)

Basic idea:

1
SMC switches have default IP 192.168.2.10, log into the switch via http interface from a PC on the same configured network, change IP (i.e. 10.1.10.10) and community string (from "public" to "digitalagora")

2
Install the snmp tools (example used Ubuntu), or "apt-cache search snmp" and find your favorite tools.
apt-get install snmp

3
Test if you see the switch:

snmpwalk -v 2c -Os -c digitalagora 10.1.10.10 system

sysDescr.0 = STRING: SMC8024L
sysObjectID.0 = OID: enterprises.202.20.59
sysUpTimeInstance = Timeticks: (981900) 2:43:39.00
sysContact.0 = STRING: SYSTEM CONTACT
sysName.0 = STRING: SMC8024L2
sysLocation.0 = STRING: SYSTEM LOCATION
sysServices.0 = INTEGER: 3

4
install mrtg by following: http://oss.oetiker.ch/mrtg/doc/mrtg-unix-guide.en.html Example:

wget http://www.zlib.net/zlib-1.2.3.tar.gz
gunzip -c zlib-*.tar.gz | tar xf -
rm zlib-*.tar.gz
mv zlib-* zlib
cd zlib
./configure
make
cd ..


5
run the cfgmaker tool to create your /etc/mrtg.cfg file, by telling it to connect to the digitalagora community @ the switch's ip. This creates a nice big config file with all the snmp info, provided that there was traffic on those ports. Otherwise, they're commented out.

cfgmaker --global 'WorkDir: /opt/website/mrtg' \
--global 'Options[_]: growright' \
--output /etc/mrtg.cfg \
digitalagora@10.1.10.10


6
run mrtg so that it sees the latest settings
env LANG=C /usr/bin/mrtg /etc/mrtg.cfg


7
Rebuild the web site's index file
indexmaker /etc/mrtg.cfg > /opt/website/mrtg/index.html


8
Look at the output.
http://localhost/mrtg/

No comments:

Post a Comment