Hello,
I have been trying for hours to get this MRTG graph to work, with no success, so it's time for me to step back and ask for a fresh set of eyes.
What I'm trying to do is graph the number of Web site hits in the past 5 minutes. Here is my script that does so:
Code:
alucard@piett:~$ cat hits.pl
#!/usr/bin/env perl
use strict; use warnings;
use LWP::Simple;
my $data = get("http://127.0.0.1/server-status?auto");
$data =~ /Total Accesses: (\d+)/;
print "$1\n$1\n";
Here is the output:
Code:
alucard@piett:~$ perl hits.pl
2570
2570
As you can see, it works there. Here is my mrtg.cfg:
Code:
######################################################################
# Multi Router Traffic Grapher -- Sample Configuration File
######################################################################
# This file is for use with mrtg-2.5.4c
# Global configuration
WorkDir: /var/www/mrtg
#WriteExpires: Yes
Title[^]: Traffic Analysis for
EnableIPv6: no
YSize[_]: 250
YTics[_]: 6
Suppress[_]: ym
RunAsDaemon: yes
Interval: 5
# [...]
Target[hits]: `perl /home/alucard/hits.pl`
Title[hits]: Site hits for piett
Options[hits]: growright, pngdate, nopercent, noinfo
MaxBytes[hits]: 1000000
YLegend[hits]: # Hits
PageTop[hits]: <h1>Site hits for piett</h1>
<p>Total Web site hits per interval</p>
MRTG is running, but the hits graph is not working. I ran indexmaker and you can see the MRTG page *edit*. The graph is being changed every five minutes (the date changes), but no data points are being graphed.
Can anyone see what I'm missing? How can I debug this further?