[rrd-users] Re: Graphing...

Cesare Tensi tensi at mclink.it
Fri Jun 20 08:14:38 MEST 2003


thanks for the tips about managing error code, at this time I'm implementing
those control around the scripts for looking errors and strange behavior.

About the problem I had, the solution was very simple, the trick is around
the "timelocal" system call. The "timelocal" need in input the "$sec, $min,
$hour, $mday, $month, $year" and output is number of second from 1/Jan/1970
(used for RRD::update).

The code was:

$yesterday_begin = timelocal(0, 0, 0, $1, $2, $3-1900);
$yesterday_end   = timelocal(59, 59, 23, $1, $2, $3-1900);

The variable "$month" start at "0" for January, "1" for February and so on..
I forget to add a "-1" on variable $2, because the variable "$yesterday"
contains, for example, "19-06-2003". So, the two variable "$yesterday_begin"
and "$yesterday_end" contains number of second passed from 1/Jan/1970 plus 1
month later...

The new code is:

$yesterday_begin = timelocal(0, 0, 0, $1, $2-1, $3-1900);
$yesterday_end   = timelocal(59, 59, 23, $1, $2-1, $3-1900);

The output, with old code, was right but graphing nothing because on RRD
database there was null data... :)


Todd A. Green <slartibartfast at awardsforfjords.com> wrote:
> If I had your datafile I could probably find it quick.  However if you
> add this to the bottom in place of your call to RRDs::Graph you will
> probably get the error message your looking for.
> my ($mmax, $xsize, $ysize) = RRDs::graph(@data);
> if (my $error = RRDs::error) {
>   print STDERR "Unable to create graph: $error\n";
> }

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