[rrd-users] Cant quite get data sample correct.

Martin Rheumer martinr at hotkey.net.au
Mon Feb 12 15:42:15 CET 2007


Am starting to write some rrdtool files manually again, and 
am pretty sure Im donig something stupid. The following script
was borrowed from archives and retrieves a set of values from
a mysql database and creates an rrd file for each ATM trunk
we have. 
Please ignore the code ( its perl but changed to protect the 
innocent coder )

   my $STEP  = 300;

   my $START = "19970101";

   my @options = ("-b", $START, "-s", $STEP,

   print "* Creating RRD $RRD1 starting at e.\n\n";
   RRDs::create $RRD1, @options;

   my $ERROR = RRDs::error;
   ok("create A", !$ERROR);                        #  2
   if ($ERROR)
      die "$0: unable to create `$RRD1': $ERROR\n";

   print "* Filling $RRD1 with values. One moment please ...\n";

   while %hash2-Query("select unix_timestamp(run_date) as
Unixtime_run_date, totald from trunk where name =
      $t = $hash2{Unixtime_run_date};
      $data1 = $hash2{totaldata};
      print "\n$RRD1 \t $t:$data1:$data1\n";
      RRDs::update $RRD1, "$t:$data1:$data1";
      if ($ERROR = RRDs::error)
          die "$0: unable to update `$RRD1': $ERROR\n";

The outout looks like this.


Now when I go and query the tsv_cn_1.bne_cs_2.tot_cells.in with rrdtool
fetch I get 

rrdtool fetch tsv_cn_1.bne_cs_2.tot_cells.in.rrd -s 1171253700 -e +10h AVERAGE
                            ds0                 ds1

1171324800: nan nan

The graphs are also very blocky and appear in 30 minute samples, where I
clearly have
5 minute data samples for the past 24 hours.

Can someone see what I have / am doing wrong. 

This has driven me mad all day today..

Thanks again

More information about the rrd-users mailing list