Tuesday, May 13, 2008

MRTG RRD Log Querying Tool

There are a lot of free MRTG front-end tools available on the web, but most of them are for the traditional MRTG logs and not for the rrd (round-robin database) log format. Though not as straight forward as sql, some complex queries can nevertheless be issued on the rrd log files using rrdtool.

This tool is a php-based rrd log querying tool developed as a part of my M.Tech thesis.

Requirements

  1. A functional web server, preferably apache
  2. MRTG and RRDTOOL should be installed on the system.
  3. In the mrtg configuration file, add LogFormat: rrdtool
  4. Enable passwordless sudo access for apache user (DEBIAN:www-data or REDHAT:apache) if you wish to add interfaces to the mrtg config through the web interface. (Read this post for the right way to do this step)

Installation

  1. In the queryMrtg.php:
    • Set $mrtgdir to the location where mrtg is configured to store its rrd logs, e.g. /var/www/mrtg
    • Set $mrtgcfg to the absolute path of the mrtg configuration file, e.g. /etc/mrtg.cfg
    • Set $rrdcommand to the rrdtool binary, e.g. /usr/bin/rrdtool
    • Set $cfgmaker to the cfgmaker binary, e.g. /usr/bin/cfgmaker
    • Set $imgdir to the directory where images will be stored. Create this as a sub-directory of the exported directory in apache (e.g. /var/www/html/images). Add the path relative to the exported directory i.e. if /var/www/html is exported in httpd.conf, then simply write 'images'.
    • In the $interfaces array, add all the interfaces that you wish to monitor and query.
  2. Copy queryMrtg.php to the web-exported directory. e.g. /var/www/html/queryMrtg.php


Usage

  1. On your browser, type - http://localhost/queryMrtg.php
  2. First time usage - Just click 'Submit'. It would report that MRTG configuration has not been added for the specified interface, and will show a button to add it. Just click!
  3. Once you have added interfaces to MRTG configuration, just play around with queries.
Contact
mailto: venkatesh@iitg.ernet.in OR rvenkatesh25@users.sourceforge.net

Screen Shots


Download

querymrtg.tar.gz

No comments: