[rrd-developers] Re: RRDs::fetch zero values returns NaN
Tobias Oetiker
oetiker at ee.ethz.ch
Thu Mar 15 19:21:00 MET 2001
Today steve rader wrote:
|
| > From: me
| > The problem is that NaN values fetched with RRDs::fetch are now
| > returned as 'undef' instead of the string 'NaN'.
|
| Now I find that RRDs::fetch is broke with respect to zero values:
| with 1.0.33, RRDs::fetch of zero values returns 'undef'.
|
| I wrote a little script to demonstrate the problem... and here's
| the results...
|
| chive(rader): rrdtool fetch -s -10min -e now \
| /usr/local/nrg/web/apache/Chive/Chive-tp.rrd AVERAGE \
| | tail -4
| 984673800: 1.1650888889e+00
| 984674100: 0.0000000000e+00
| 984674400: 0.0000000000e+00
| 984674700: NaN
|
| chive(rader): ./rrdfetch.pl \
| /usr/local/nrg/web/apache/Chive/Chive-tp.rrd AVERAGE \
| | tail -4
| 984673800: 1.1650888889e+00
| 984674100: 0.0000000000e+00 (undef)
| 984674400: 0.0000000000e+00 (undef)
| 984674700: 0.0000000000e+00 (undef)
hmm not sure what is happening here, but the line in the perl
bindings looks quite simple to me:
av_push(line,(isnan(*datai) ? &PL_sv_undef : newSVnv(*datai)));
anyone ?
tobi
| #
|
| use lib '/usr/local/rrdtool-1.0.33/lib/perl';
| use RRDs;
| ($start,$step,$names,$data) = RRDs::fetch ("$ARGV[0]",'AVERAGE');
| if ( $error = RRDs::error ) {
| print "rrdtool fetch failed: \"$error\"\n";
| exit 1;
| }
| $d_start = $start;
| foreach $line (@$data) {
| print " $d_start: ";
| $d_start += $step;
| foreach $val (@$line) {
| printf "%1.10e ", $val;
| if ( ! $val ) { print " (undef)"; }
| }
| print "\n";
| }
|
|
| --
| Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
| Help mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
| Archive http://www.ee.ethz.ch/~slist/rrd-developers
| WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
|
|
--
______ __ _
/_ __/_ / / (_) Oetiker, Timelord & SysMgr @ EE-Dept ETH-Zurich
/ // _ \/ _ \/ / TEL: +41(0)1-6325286 FAX:...1517 ICQ: 10419518
/_/ \.__/_.__/_/ oetiker at ee.ethz.ch http://ee-staff.ethz.ch/~oetiker
--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-developers
mailing list