[rrd-developers] [PATCH] libdbi

Hans Jørgen Jakobsen hjj at wheel.dk
Wed Nov 10 19:07:18 CET 2010


Here is a patch for libdbi access.
1) Sigma calculation had an error. The first data value in each bin 
didn't get squared.

2) "rrdfillmissing" was dummy. I have added code to do the work. The 
parameter has NOW to be in seconds. In doc it is given in steps. The 
size of steps depends to much on size of graph so I think its easier to 
use seconds and internal calculate the number of steps.

(I have mailed with Martin Sperl)
/hjj
-------------- next part --------------
--- rrdgraph_libdbi.pod 2010-11-10 13:55:23.000000000 +0100
+++ rrdgraph_libdbi.pod.orig    2010-11-10 13:52:38.000000000 +0100
@@ -7 +7 @@
-E<lt>rrdfileE<gt> = B<sql//E<lt>libdbi driverE<gt>/E<lt>driver-option-nameE<gt>=E<lt>driver-option-valueE<gt>/...[/rrdminstepsize=E<lt>stepsizeE<gt>][/rrdfillmissing=E<lt>fill missing n secondsE<gt>]//E<lt>tableE<gt>/E<lt>unixtimestamp columnE<gt>/E<lt>data value columnE<gt>[/derive]/E<lt>where clause 1E<gt>/.../E<lt>where clause nE<gt>>
+E<lt>rrdfileE<gt> = B<sql//E<lt>libdbi driverE<gt>/E<lt>driver-option-nameE<gt>=E<lt>driver-option-valueE<gt>/...[/rrdminstepsize=E<lt>stepsizeE<gt>][/rrdfillmissing=E<lt>fill missing n samplesE<gt>]//E<lt>tableE<gt>/E<lt>unixtimestamp columnE<gt>/E<lt>data value columnE<gt>[/derive]/E<lt>where clause 1E<gt>/.../E<lt>where clause nE<gt>>
@@ -32 +32 @@
-=item B</rrdfillmissing>=B<E<lt>fill missing secondsE<gt>>
+=item B</rrdfillmissing>=B<E<lt>fill missing stepsE<gt>>
@@ -34 +34 @@
-  defines the number of seconds to fill with the last value to avoid NaN boxes due to data-insertation jitter (default: 0 seconds)
+  defines the number of steps to fill with the last value to avoid NaN boxes due to data-insertation jitter (default: 0 steps)
-------------- next part --------------
--- rrd_fetch_libdbi.c  2010-11-10 09:24:40.000000000 +0100
+++ rrd_fetch_libdbi.c.orig     2010-04-07 15:04:33.000000000 +0200
@@ -617 +617 @@
-       (*data)[idx*(*ds_cnt)+4]=r_value*r_value; /* SIGMA */
+       (*data)[idx*(*ds_cnt)+4]=r_value; /* SIGMA */
@@ -654,24 +653,0 @@
-  /* Fill in missing values */
-  fillmissing/=(*step);/* Convert from seconds to steps */
-  if (fillmissing>0) {
-    int copy_left=fillmissing;
-    for(idx=1;idx<rows;idx++) {
-      long count=(*data)[idx*(*ds_cnt)+3];
-      if (count==0) {
-        /* No data this bin */
-        if (copy_left>0) {
-          /* But we can copy from previous */
-          int idx_p=idx-1;
-          (*data)[idx*(*ds_cnt)+0]=(*data)[idx_p*(*ds_cnt)+0];
-          (*data)[idx*(*ds_cnt)+1]=(*data)[idx_p*(*ds_cnt)+1];
-          (*data)[idx*(*ds_cnt)+2]=(*data)[idx_p*(*ds_cnt)+2];
-          (*data)[idx*(*ds_cnt)+3]=(*data)[idx_p*(*ds_cnt)+3];
-          (*data)[idx*(*ds_cnt)+4]=(*data)[idx_p*(*ds_cnt)+4];
-          copy_left--;
-        }
-      }else{
-        copy_left=fillmissing;
-      }
-    }
-  }
-


More information about the rrd-developers mailing list