On Thu, Oct 10, 2002 at 09:51:35AM +0100, [EMAIL PROTECTED] wrote:

> We have some historic data that we want to add into RRD .... The format of the
> data is as follows :
> 
> 01 Oct 2002 08:16:43 23364 Login
> 01 Oct 2002 08:21:32 12067 Login
> 
> The script I am using to populate is detailed below, but when I fetch the data
> back it always shows as NaN ... Cannot work out what I am doing wrong ?

In your script:  generate a log file of commands you execute
(or: would like to execute).

Then use this file to debug the update process step by step.

>         my ($day,$month,$year,$time,$response,$type) = split (" ",$_);
>         if ($type =~ /Login/ && $response > 0) {
>                 $date=&ParseDateString("$day $month $year $time");
>                 $epoch=&UnixDate($date,"%s");
>                 $response=int($response);

It seems as if "epoch" becomes 1009839600 and similar.
"response" becomes 23364.  At least, that's what it looks
like to me.  Verify this.

>                 printf("%s %s\n",$epoch,$response);

Why not do: printf("rrdtool update %s %s:%s\n",$rrd,$epoch,$response);

>  RRDs::update("$rrd","$epoch:$response");
>  my $e = RRDs::error();
>  die "ERROR: Cannot update $rrd with '$epoch:$response' $e\n" if $e;

Not sure if this will report a logical error.  It will report a hard
error such as "file not found" et al.

Create the database by hand and then update using the printf()ed
commands.  After each update, check using rrdtool info.  Maybe even
do a rrdtool dump and check its contents (your fetch command may
be wrong !!!)

HTH
Alex

--
Unsubscribe mailto:[EMAIL PROTECTED]
Help        mailto:[EMAIL PROTECTED]
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

Reply via email to