[rrd-users] Re: Numbers in RRD

Serge Maandag serge.maandag at staff.zeelandnet.nl
Mon Mar 3 17:48:25 MET 2003

Well first of all,  rrdtool fetch --start now returns something like this:

                      ds0           ds1

1046709000: 0.0000000000e+00 6.9906300000e+03
1046709300: nan nan

The first two lines are descriptive, the third line holds the value and the last value always is NaN by design.

therefore, try:

int0_pre=`rrdtool fetch  $ourfile AVERAGE --start now | head -3 | tail -1 | awk '{print $2}'`


there's a problem with quotes, double qoutes and stuff. variables do not get expanded if they're enclosed in single quotes. Try:
int0=`perl -e "print scalar \"$int0_pre\" + 0"`

Thirdly, you probably should write som code to handle nan's.


-----Original Message-----
From: Mohamed Eldesoky [mailto:m.eldesoky at tedata.net]
Sent: Monday, March 03, 2003 2:28 PM
To: Serge Maandag; RRD List
Subject: Re: [rrd-users] Re: Numbers in RRD

I tried it, and it works.
But I can't use it inside my bash script
Here is what I tried, with no success

if [[ -e $ourfile ]]; then
int0_pre=`rrdtool fetch  $ourfile AVERAGE --start now|tail -1|awk '{print 
int0=`perl -e 'print scalar $int0_pre + 0'`
int1_pre=`rrdtool fetch  $ourfile AVERAGE --start now|tail -1|awk '{print 
int1=`perl -e 'print scalar $int1_pre + 0'`

Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the rrd-users mailing list