[rrd-users] Problem with the date range

Laura McCord mccordl at southwestern.edu
Mon Sep 8 23:56:43 CEST 2008


Hi,

It's my first time messing with rrdtool and I have an existing rrd 
database that was created from someone else that I need to use for my 
graph. Basically, I am trying to gather hourly data starting from this 
month to the current date but I am having trouble with the fetch 
command. This is what I have:

        #Every Hour
       my $res = '3600';

       #End on Today's Date
       my $end = int(time/$res)*$res;

       my $month = (60*60*24*7*4);

       #Start September 1, 2008
       my $begin = "$end - $month";

       my ($start,$step,$names,$data) = 
RRDs::fetch("stats.rrd","AVERAGE","-r","$res","-e", "$end","-s","$begin");
       for my $line (@$data) {
               print "  ", scalar localtime($start), " ($start) ";
               $start += $res;
               for my $val (@$line) {
                       printf "%12.1f ", $val;
               }
               print "\n";
       }
       The problem that I am facing is that when I print out the output 
the date starts as it should but the end date continues through January 
2009 when it should stop on today's date.

I read the documentation about the start and end date are supposed to be 
increments of the resolution. I think I am doing this correctly.

Thanks,
Laura



More information about the rrd-users mailing list