LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   MRTG config sanity check (https://www.linuxquestions.org/questions/linux-server-73/mrtg-config-sanity-check-707166/)

AlucardZero 02-24-2009 11:54 AM

MRTG config sanity check
 
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?

AlucardZero 02-24-2009 07:55 PM

Multiplying my data output by 100 started actually getting me data points on the graph. I'll play with that and Factor / YTicsFactor now.


All times are GMT -5. The time now is 07:26 PM.