[rrd-developers] Re: RRDs::fetch zero values returns NaN
Mark Mills
mark at xodiax.com
Thu Mar 15 18:01:53 MET 2001
No, you have Borked your perl code... You need to test
for "defined"ness rather than truth.
#!/usr/bin/perl
#
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 ( !defined $val ) { print " (undef)"; }
}
print "\n";
}
-----Original Message-----
From: steve rader [mailto:rader at ginseng.physics.wisc.edu]
Sent: Thursday, March 15, 2001 11:47 AM
To: rrd-developers at list.ee.ethz.ch
Subject: [rrd-developers] RRDs::fetch zero values returns NaN
> 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)
steve
- - -
systems & network guy
high energy physics
university of wisconsin
- - -
#!/usr/bin/perl
#
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
--
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