[rrd-users] Re: Numbers in RRD

Mohamed Eldesoky m.eldesoky at tedata.net
Mon Mar 3 14:27:37 MET 2003


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

_______________________
ourfile="$int".rrd
if [[ -e $ourfile ]]; then
int0_pre=`rrdtool fetch  $ourfile AVERAGE --start now|tail -1|awk '{print 
$2}'`
int0=`perl -e 'print scalar $int0_pre + 0'`
int1_pre=`rrdtool fetch  $ourfile AVERAGE --start now|tail -1|awk '{print 
$3}'`
int1=`perl -e 'print scalar $int1_pre + 0'`
________________________


On Monday 03 March 2003 1:19 pm, Serge Maandag wrote:
This works:

#!/usr/bin/perl
my @fetch =  (

    "1046603100: 9.1611673504e+03 1.5467979183e+03",

    "1046603400: 1.1340893311e+04 1.7779534000e+03",

    "1046603700: 8.1045792667e+03 1.7648692000e+03",

);
for (@fetch) {

    /(.*?): (.*) (.*)\s*$/ && do {

        print "time = $1\n";

        print "ds0 = " . scalar $2 + 0 . "\n";

        print "ds1 = " . scalar $3 + 0 . "\n";

        $total_ds0 += $2;

        $total_ds1 += $3;

    }

}



print "totals:\n\tds0:$total_ds0\n\tds1:$total_ds1\n";



Serge



-----Original Message-----

From: Mohamed Eldesoky [mailto:m.eldesoky at tedata.net]

Sent: Monday, March 03, 2003 12:06 PM

To: Serge Maandag; RRD List

Subject: Re: [rrd-users] Re: Numbers in RRD





Thanks serge, but didn't work



Basically, I want to sum the numbers returned from rrdfetch, for some

reasons,

I can't use CDEF's

And it is clear that the scientific notation doesn't work with me !!!



Regards

Mohamed Eldesoky



On Monday 03 March 2003 11:29 am, Serge Maandag wrote:



If you use perl, add 0 to force it to a number:



perl -e 'print "2.00000e-2" + 0'

0.02



Serge.



-----Original Message-----



From: Mohamed Eldesoky [mailto:m.eldesoky at tedata.net]



Sent: Monday, March 03, 2003 9:31 AM



To: RRD List



Subject: [rrd-users] Numbers in RRD









Is there anyway to get the values stored in RRD expanded ??



I mean not to be in the form



x.yyyyyyyyez







Regards



Mohamed Eldesoky

-- 
Person who say it cannot be done should not interrupt person doing it.  
--Chinese Proverb 

--
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