MRTG on debian

Installing an configuring mrtg on debian is quite straightforward. Just issue a "apt-get install mrtg" and you're done. 
As for configuring it, there are just another few minutes more. You can use a very useful utility, called "cfgmaker" 
to generate the config file needed by mrtg. For example:

~#cfgmaker community@device1 > /etc/mrtg/device1.cfg,
where community is the ro snmp community, device1 is either an ip address either it's FQDN hostname. 
Next you can edit /etc/mrtg/device1.cfg to fine tune the configuration. 
It's recommended that you make a different config for every device you wish to monitor. Also, make sure you edit the 
WorkDir parameter in the config file which tells mrtg where to put the generated html files. You can use "indexmaker" 
to generate an index file for the html files that mrtg outputs in WorkDir.

Next, we need to poll the snmp on the device periodically, so we add some entries in the crontab like this:

*/5 * * * *     nice /usr/bin/mrtg /etc/mrtg/device1.cfg 2>&1 >/dev/null 2>/dev/null
which will run mrtg every 5 minutes with low priority.

For calculating mrtg totals I've used a tool called mrtg_total which can be found here: 
http://www.geocities.com/josef_wendel/mrtg_total.html

Basically, it's a perl script that totals the information stored in the mrtg log files. Installation is straightforward,
just add the required tags (described in the documentation) to the mrtg config file and add another entry to crontab:

30 0 * * *      nice /usr/sbin/mrtg_total.pl /etc/mrtg/device1.cfg 2>&1 >/dev/null 2>/dev/null

This is run only once per day because mrtg_total only totals a complete day.

Another tool that could be used in this case is mrtg-traffic-sum. You can read more about this and other mrtg tools 
here: http://oss.oetiker.ch/mrtg/doc/mrtg-traffic-sum.en.html
Dette indlæg blev udgivet i Knowledge Base, Linux, Old Base. Bogmærk permalinket.

Skriv et svar