Proxy Cache Monitoring Suite

The Proxy Cache Monitoring Suite collects data about the current state of one or more Squid proxy caches and generates HTML pages containing GIF images which provide a LIVE visual representation of the gathered data.

The package consists of 3 components:


GPS4A To get GPS4A to work, you have to do the following steps:

  1. Install Perl5.003 or later, if it is not already installed on your system!
  2. Check, whether Graham Barrs Date::Parse Module is installed on your system (per default /usr/local/lib/perl5/site_perl/Date/Parse.pm) . If not, download the latest TimeDate-1.x.tar.gz package, uncompress it with gunzip -c TimeDate-1.x.tar.gz | tar xvf -, read the README file and install it.
  3. Install the MRTG software and fix mrtg as described below!
  4. Install the echoping software!
  5. create a gps4a configuration file!
    The easiest way to do this is to download this configuration file and adapt it to your needs. Everything you need to know for this is described in the file itself. Per default gps4a.pl searches for a configuration named .grc but you can overwrite this behavior by using the option -f config_file.
  6. Hold down the shift key and klick on the following link : gps4a.pl.gz to download gps4a. Uncompress the file with gunzip gps4a.pl.
    If you have problems downloading it, try it from the download page.
  7. start gps4a.pl -c or gps4a.pl -c -f your_config_file. At this point gps4a.pl tries to create in your htmldir one sub directory for each cache, you want to monitor. The name of these sub directories are equivalent to the keywords you specified in your config file for the corresponding caches. Further more it creates in these directories the configuration files for the MTRG program. You might have a look at them and change e.g. the Title or PageTop lines. But beware, read the MRTG man pages carefully, if you want to make other changes!!!
  8. start gps4a.pl or gps4a.pl -f your_config_file and watch the output for the lines like "Couldn't get any data from ...". If you encounter such lines, make sure that the passwords you specified in the config file are ok and that your machine is allowed to request the cache objects info, stats/dns, stats/utilization and verify that echoping works.
    NOTE: gps4a first gets all data from the caches and than invokes MRTG to generate/update the HTML pages and gifs. If MRTG runs the first or second time, it (rateup) issues messages, that it didn't find old log files and that it can't remove old log files. That's ok. But at the third time you run gps4a there should be no such messages anymore.
  9. Check if the generated html pages are ok: Have a look at at the html pages located under your htmldir/$keyword directories, where keyword is equivalent with the keywords you specified in your configuration file.
  10. If everything looks ok, create a cronjob, which calls gps4a every 5 minutes, e.g.
    0,5,10,15,20,25,30,35,40,45,50,55 * * * * etc/gps4a.pl -f etc/gps4a.conf
    
  11. Check whether the cron job is invoked from cron and if the gifs are updated.
  12. Create a summary html page like this one to have easy acces to the information you want. Feel free to use this html pages as your template to get the job done quickly ;-).
gps4a gathers all data for all dns servers running on the proxy cache machine and stores them in htmldir/keyword/data/dnsN with N = {1 .. NumberOfDNSServers}. If you want to have MRTG to graph the data from more than the first 5 DNS Servers, you have to add the appropriate options to the mrtg.conf files (Have a look at the first 5 entries for DNS Servers and you will know, how to add the others ;-) ).


EchoPing "echoping" is a small program to test (approximatively) performances of a remote host by sending it TCP "echo" (or other protocol) packets. Download the software from ftp://ftp.internatif.org/pub/unix/echoping/ uncompress it with the command gunzip -c echoping.tar.gz | tar xvf -, read the INSTALL file and install the software.
FYI: When gps4a calls echoping, it uses the parameters -n -t 10 -h as well as the information from your gps4a configuration file (Address, Port, Password, testurl) and passes the Median time to MRTG.


MRTG MRTG is a standalone program written by Tobias Oetiker. To get gps4a work, you need to install this software. For detailed information about this read the Getting and Installing MRTG section on the MRTG home page, please.

After the installation
You need to fix the mrtg program to get it work properly!!!

Since mrtg is a perl program, use your favorite text editor, load the mrtg program and jump to the line 614 in version 2.4 :

  if ($$rcfg{targcount}{$rou} == 1) {
    $mode='uptime';
    $uptime = $$target{$$rcfg{targorig}{$rou}}{'uptime'};
    $name = $$target{$$rcfg{targorig}{$rou}}{'name'};
  }
and replace the lines above with the following lines:
  if ($$rcfg{targcount}{$rou} == 1) {
    my $targ;
    $mode='uptime';
    $targ = $$rcfg{targorig}{$rou};
    $targ =~ s/.*(\`[^\`]+\`).*/$1/ if $targ =~ m#\`[^\`]+\`#;
    $uptime = $$target{$targ}{'uptime'};
    $name = $$target{$targ}{'name'};
  }
This is necessary because mrtg handles mrtg.conf Target lines not properly if you use Targets like this:
Target[dns1]: `cat data/dns1` * 60
Without the fix mrtg stores internal data with the key "`cat data/dns1`" but tries to look up the uptime and name values with the key "`cat data/dns1` * 60" which results in emtpy values. Tobias considers this as a feature, I consider it as a bug ;-).

All other tools, which use mrtg, should work with this fix as well. If you don't trust it or it screw up your tools using mrtg, just copy mrtg to mrtg.gps4a, make the fix there and enter the appropriate value in your gps4a configuration file (e.g. mrtg=/localapp/mrtg/mrtg.gps4a). No further changes are necessary.