MRTG Statistics Archiever Version 0.2 Oleg Krotoff 16/06/2000 --------- Intro and Disclaimer This script was written as a result of attempts to provide automatic archiving of graphs, generated by MRTG for all targets. I failed to customize the scripts written by Emanuele Leonardi and Rawlin Blake (their scripts supplied with MRTG in contrib) so I wrote my own. The script provided "as-is", just because it may be usefull for someone with the same needs. It works for me, but I can't be sure that it will work for you. It was tested only with Linux 2.2.14 -- 2.2.16, Apache 1.3.6 -- 1.3.12 and Perl 5.6. --------- * mrtg-archiver Main part is the 'mrtg-archiver' script itself. It tries to parse MRTG configuration file and extracts the list of targets. Then the script copies graphs and necessary parts of html file to the archive. * Command-line options: -conf=/path/to/config-file MRTG configuration file -arch=/path/to/archive Path to folder, where the archive will be stored. You should create folders 'days', 'weeks', 'months' 'years' in it and also you can place the supplied index.html to the archive folder. All other indexes are produced automaticaly. -d Produce daily archive -w Produce weekly archive -m Produce monthly archive -y Produce yearly archive -back=n Tell the archiever, that date, to which the archiving process is made was n seconds earlier. This allows to make daily archives at, for example, 3:00am but mark them by correct (yesterday) date. The script relies heavily on the structure of html files produced by MRTG, so if the structure change substantialy the script will possibly crash. * What you can customize in script: The variable $GroupRE contains regular expression to group targets. Currently it groups targets by router IP in target itself, assuming that target name starts from router IP. You can change it to anything you want and also you can group targets by some parts in Title. For this you should comment out line 178 and uncomment line 179. The variable $img_suffix contains the suffix (currently 'png') of graph files produced by MRTG. If your MRTG produces gifs, you can change this variable's value to 'gif'. * Starting the archiver mrtg-archive supposed to be started by cron. The example lines to be put in crontab are supplied in file 'to-crontab' * Navigating through archives To provide the navigation through archives, the cgi-script 'mrtgnav' should be placed into /cgi-bin/mrtg of your WWW server. It requires URI.pm to be installed on your site. You may need to change the value of $HtmlBase, it should contain the location of Web server document root. The idea of the navigation script was inspired by Cooler (http://cooler.irk.ru).