MRTG – monitoring sítě

http://labs.erweb.it/pub/installing_mrtg.php

Installing MRTG


What if you could be always aware of what’s happening on your machines? MRTG is a fantastic tool that keeps track of several processes on servers via SNMP.

This article shows you how to install MRTG and our MRTG addon on a Linux based machine (we do this for CentOS + BlueQuartz but actually works fine with every distribution).

MRTG itself

Login to your machine and become root with the „su“ command. Then create a download directory, to be nice to your system, in root’s home dir. Let’s call the download directory „installation_dir“:

cd
mkdir installation_dir
cd installation_dir

Then locate the MRTG rpm accordingly with your distribution (we found it on the CentOS site)

wget http://####somepath#####/mrtg-2.10.15-1.i386.rpm
rpm -i mrtg-2.10.15-1.i386.rpm

OR (more easy)

yum install mrtg

Now you have to decide WHERE do you want to see your graphs and infos. Maybe you want to put a MRTG dir in your wwwroot where you will find all the datas.

mkdir /PATH_TO_WWWROOT/web/mrtg

Now you have to create a good configuration file located at /etc/mrtg/mrtg.cfg . Remember to replace PATH_TO_WWWROOT and YOUR_IP_ADDRESS with the right values:

cfgmaker –global ‚Workdir: /PATH_TO_WWWROOT/mrtg‘ –global ‚Options[_]: bits,growright‘ –output /etc/mrtg/mrtg.cfg YOUR_IP_ADDRESS

To test the installation run (yes run it twice):

/usr/bin/mrtg /etc/mrtg/mrtg.cfg –lock-file /var/lock/mrtg/mrtg_l –confcache-file /var/lib/mrtg/mrtg.ok
/usr/bin/mrtg /etc/mrtg/mrtg.cfg –lock-file /var/lock/mrtg/mrtg_l –confcache-file /var/lib/mrtg/mrtg.ok

Now open the text editor

pico /etc/cron.d/mrtg

and type:

*/5 * * * * root /usr/bin/mrtg /etc/mrtg/mrtg.cfg –lock-file /var/lock/mrtg/mrtg_l –confcache-file /var/lib/mrtg/mrtg.ok

so that MRTG will run each five minutes.

Tha’s It, wait ten minutes and point your browser to the MRTG directory created!