X-Git-Url: https://git.tokkee.org/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_fetch_libdbi.c;h=b4f0fc7912f012e469423131cffcdb7340e180e9;hp=2c4c722ee46ecbbbd8d95ece84c8deb8c4899d5a;hb=923710084cd4b2aacf77da4feffd72fa7b4df2e3;hpb=c265653b4507e0af5333c9ce51cd4d7420266436 diff --git a/src/rrd_fetch_libdbi.c b/src/rrd_fetch_libdbi.c index 2c4c722..b4f0fc7 100644 --- a/src/rrd_fetch_libdbi.c +++ b/src/rrd_fetch_libdbi.c @@ -615,7 +615,7 @@ rrd_fetch_fn_libdbi( (*data)[idx*(*ds_cnt)+1]=r_value; /* AVG */ (*data)[idx*(*ds_cnt)+2]=r_value; /* MAX */ (*data)[idx*(*ds_cnt)+3]=1; /* COUNT */ - (*data)[idx*(*ds_cnt)+4]=r_value; /* SIGMA */ + (*data)[idx*(*ds_cnt)+4]=r_value*r_value; /* SIGMA */ } else { /* MIN */ if ((*data)[idx*(*ds_cnt)+0]>r_value) { (*data)[idx*(*ds_cnt)+0]=r_value; } @@ -652,6 +652,30 @@ rrd_fetch_fn_libdbi( } } + /* Fill in missing values */ + fillmissing/=(*step);/* Convert from seconds to steps */ + if (fillmissing>0) { + int copy_left=fillmissing; + for(idx=1;idx0) { + /* 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; + } + } + } + /* and return OK */ return 0; }