Tuesday, July 04, 2006

I think it would be best to put some of the network configurations here. I am talking about MRTG. I have my notes on how to install mrtg on redhat 7.1, this is way too old though. Since I have Fedora Core 4 installed then it would be great to place some of the configuration for future reference. My opening salvo would be Tobias Oetiker and Dave Rand's MRTG.

To have a perfect mrtg installation, these files are necessary --- (1)GCC and Perl, (these files are pre-installed on most linux system) and three vital libraries to make mrtg run (2) gd [gd-1.8.4.tar.gz] (this is basic graph drawing library created by Thomas Boutell)--- (3) libpng [libpng-1.0.15.tar.gz] (required by gd in order to produce PNG grahic files). --- (4) zlib [zlib-1.1.4.tar.gz] (is needed by libpng to compress the graphics files that is being created). --- (5) mrtg [mrtg-2.14.4.tar.gz ] (the mrtg itself). So there you go, you have the files and we are about to go!

Library Compilation

To download the files just execute "wget" and be sure to place your source files in /usr/local/src directory (after unzipping the source files i usually have a copy of them on my home directory just in case I have to reinstall the service, i hate the idea of downloading them again and again). After acquiring the libraries ,it is time to compile the libraries one by one. And once again compile them in /usr/local/src/ directory. Lets start first with zlib.

1) tar xzvf zlib-1.1.4.tar.gz
2) mv zlib-1.1.4 zlib
3) cd zlib
4) ./configure
5) make
6) cd ..


Next library to compile

1) tar xzvf libpng-*.tar.gz
2) mv libpng-* libpng
3) cd libpng
4) make -f scripts/makefile.std CC=gcc ZLIBLIB=../zlib ZLIBINC=../zlib
5) cd ..

We are now ready to compile that gd library.

1) tar xzvf gd-*.tar.gz
2) mv gd-* gd
3) cd gd
4) make INCLUDEDIRS="-I. -I../zlib -I../libpng" \
LIBDIRS="-L../zlib -L. -L../libpng" \

LIBS="-lgd -lpng -lz -lm" \
CFLAGS="-O -DHAVE_LIBPNG"
5) cd ..


We are set to compile the mrtg!

1) tar xzvf mrtg-2.14.4.tar.gz
2) cd mrtg-2.14.4
3) ./configure --prefix=/usr/local/mrtg-2 --with-gd=/usr/local/src/gd --with-z=/usr/local/src/zlib --with-png=/usr/local/src/libpng
4) make

We are half way to finish !

it's time to configure mrtg to monitor network device. So in my case here in UC we have 4 satellite campuses, I need to monitor the bandwidth utilization of our CISCO router serial interfaces. First things first, we need to determine the SNMP setting of the router, like for
instance our UC Banilad router's SNMP setting is UCICTC. let's hit it.

1) cd /usr/local/src/mrtg-*.*/bin
2) ./cfgmaker UCICT@172.23.251.170 >> ictc.cfg (UCICTC-is the SNMP setting,
172.23.251.170-the ip address of our serial interface,

ictc.cfg- the configuration file for UC Banilad Router)
3) executing ./cfgmaker would take awhile, then after cfgmaker getting the configuration file of your router, edit ictc.cfg

4) vi ictc.cfg (add this lines on the configuration:
WorkDir: /var/www/html/mrtg (this would depend to where your httpd is)
Interval: 5 (time interval of refresh
RunAsDaemon: Yes
Options[_]: growright, bits (Uncomment this one)

5) After editing the configuration file, time to create Index file for the configuraiton.

Execute: ./indexmaker ictc.cfg (then the index file will be displayed and placed to the
work directory which is /var/www/html/mrtg


6) Execute: env LANG=C ./mrtg ictc.cfg
7) Add a line to your crontab file, so edit /etc/crontab and put this line below.

0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/src/mrtg-2.14.4/bin/mrtg /usr/local/src/mrtg-2.14.4/bin/ictc.cfg 1> /dev/null 2> /dev/null

So there you have it, just follow the instruction for other campuses. to check if you have mrtg working go to

http://192.168.1.100/mrtg/172.23.251.170_2.html.

No comments: