[rrd-users] Problems feeding the data to the .rrd file

Vishal Suri vishal at tsproviders.net
Fri Mar 15 04:53:11 MET 2002


Hi all,

I am trying to graph the response times of a web server for a small project.
I created the database with the following command

rrdtool create -s 120 DS:time:GAUGE:300:1:20 RRA:MAX:0.5:1:600
RRA:MAX:0.5:6:720
(haven't added the monthly and yearly graphs for the initial test)

Following is the perl script that measures the download time of a site and
stores it in $time_diff variable which i am trying to feed into the rrd file
(and thats where i'm having difficulties):

#! /usr/bin/perl -w

########################################################################

#	Following lines are added because of the @INC error(perl search path
messed up)
BEGIN
{
	$scriptsDir="D:/Perl/lib";
	$scriptsDir1 = "D:/Perl/site/lib";
	$RRDslib="D:/Downloads/RRDTool/perl-shared";
	unshift(@INC,$RRDslib);
	unshift(@INC,$scriptsDir);
	unshift(@INC,$scriptsDir1);
}

use LWP::UserAgent;
use RRDs;

#	Start the timer
my $time_begin = time;

die "$0 requires an argument.\nUsage: $0 URL\n" if $#ARGV != 0;

$URL = $ARGV[0];

$ua = new LWP::UserAgent;

$ua->agent("FastTide-Quick1.0" . $ua->agent);

$ua->timeout(30);

$req = new HTTP::Request('GET', $URL);

die("Could not make an HTTP request.\n") unless (defined($req));

my($resp) = $ua->request($req);

if (!$resp->is_success) {

	printf ("ERROR: Retrieval failed!\n");

	exit 2;

}

#	Print the page
printf ("%s", $resp->content);

#	Stop the timer and then calculate the difference
my $time_done = time;
my $time_diff = $time_done - $time_begin;

#	Define OK, Warning, and Critical thresholds
if ($time_diff <= 3)
{
	printf("OK : took %d seconds", $time_diff);
}
elsif ($time_diff > 3 && $time_diff <= 7)
{
	printf("WARNING : took %d seconds", $time_diff);
}
elsif ($time_diff > 7)
{
	printf("%s", "CRITICAL : took longer than 7 seconds");
}

printf(time);

#	Run the RRD Update and feed the time_diff into the .rrd file
RRDs::update ("time_test.rrd", "", "time", "N:$time_diff");

exit 0;


The script seems to run fine but the when i try to fetch the data out of the
database, it never seems to have it. I'm sure i'm doing something wrong and
any help would be greatly appreciated.

Thanks,
Vishal Suri
vishal at tsproviders.net


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list