RRA AVERAGE:0.5:1 undesirable result

View: New views
6 Messages — Rating Filter:   Alert me  

RRA AVERAGE:0.5:1 undesirable result

by kssgill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,  I've setup a test RRA as shown below and create a perl script to popuate
it with test data. I'm see rounding off of data which is not what I was
expecting.

This is how I created an rrd file:

rrdtool create testfile.rrd  -s 20 DS:await:GAUGE:40:0:10000000
RRA:AVERAGE:0.5:1:1598400

Attached is the perl script I use to update the rrd file.

#!/opt/perl2exe/perl5/bin/perl

my $i=2;
while ( true ) {

print "updating: $i\n";

my $rrdUpd = `rrdupdate testfile.rrd -t await N:$i`; chomp($rrdUpd);
$i=$i+2;
sleep(20);


}


I let it run for a few minutes while it updates the numbers:
updating: 2
updating: 4
updating: 6
updating: 8
updating: 10
updating: 12
updating: 14
updating: 16
updating: 18
updating: 20
updating: 22
updating: 24
updating: 26

I then did a dump of the rrd in a txt readable format as :

rrdtool dump testfile.rrd > testfile1.dump

I then look for my updates.

grep -v 'NaN' testfile2.dump


<!-- Round Robin Database Dump --><rrd> <version> 0003 </version>
        <step> 20 </step> <!-- Seconds -->
        <lastupdate> 1255382402 </lastupdate> <!-- 2009-10-12 17:20:02 EDT
-->

        <ds>
                <name> await </name>
                <type> GAUGE </type>
                <minimal_heartbeat> 40 </minimal_heartbeat>
                <min> 0.0000000000e+00 </min>
                <max> 1.0000000000e+07 </max>

                <!-- PDP Status -->
                <last_ds> 8 </last_ds>
                <value> 2.3504256000e+01 </value>
                <unknown_sec> 0 </unknown_sec>
        </ds>

<!-- Round Robin Archives -->   <rra>
                <cf> AVERAGE </cf>
                <pdp_per_row> 1 </pdp_per_row> <!-- 20 seconds -->

                <params>
                <xff> 5.0000000000e-01 </xff>
                </params>
                <cdp_prep>
                        <ds>
                        <primary_value> 7.7067147000e+00 </primary_value>
                        <secondary_value> 0.0000000000e+00
</secondary_value>
                        <unknown_datapoints> 0 </unknown_datapoints>
                        </ds>
                </cdp_prep>
                <database>
                        <!-- 2009-10-12 17:19:00 EDT / 1255382340 -->
<row><v> 2.0000000000e+00 </v></row>
                        <!-- 2009-10-12 17:19:20 EDT / 1255382360 -->
<row><v> 3.7085260000e+00 </v></row>
                        <!-- 2009-10-12 17:19:40 EDT / 1255382380 -->
<row><v> 5.7077767000e+00 </v></row>
                        <!-- 2009-10-12 17:20:00 EDT / 1255382400 -->
<row><v> 7.7067147000e+00 </v></row>
                </database>
        </rra>
</rrd>


And I'm surprised to see that instead of see 2,4,6,8. The numbers are
2,3.7,5.7,7.7

2.0000000000e+00
3.7085260000e+00
5.7077767000e+00
7.7067147000e+00

Not able to understand how I lost percision on the number.  From reading
online Average:0.5:1 should be the number it self.


rrdtool version is:

 rrdtool -v
RRDtool 1.2.27  Copyright 1997-2008 by Tobias Oetiker <tobi@...>
               Compiled Oct 24 2008 03:40:57

--
View this message in context: http://n2.nabble.com/RRA-AVERAGE-0-5-1-undesirable-result-tp3810921p3810921.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.

_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Re: RRA AVERAGE:0.5:1 undesirable result

by Marc Powell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Oct 12, 2009, at 4:48 PM, kssgill wrote:

>
> Hi,  I've setup a test RRA as shown below and create a perl script  
> to popuate
> it with test data. I'm see rounding off of data which is not what I  
> was
> expecting.
>
> This is how I created an rrd file:
>
> rrdtool create testfile.rrd  -s 20 DS:await:GAUGE:40:0:10000000
> RRA:AVERAGE:0.5:1:1598400

I'm not an rrdtool expert but... You don't specify a start time so  
you're telling rrdtool to expect updates at exactly 20 second  
intervals from [the time this file is created -10 seconds]...

> my $rrdUpd = `rrdupdate testfile.rrd -t await N:$i`; chomp($rrdUpd);

This uses the current timestamp (N), which may or may not be exactly a  
20 second interval from the above start time...

> And I'm surprised to see that instead of see 2,4,6,8. The numbers are
> 2,3.7,5.7,7.7
>
> 2.0000000000e+00
> 3.7085260000e+00
> 5.7077767000e+00
> 7.7067147000e+00
>
> Not able to understand how I lost percision on the number.  From  
> reading
> online Average:0.5:1 should be the number it self.

Only if you input data on the exact timestamps that correspond to the  
buckets (steps from start) you've created in the RRD. In your case,  
your insert timestamp is a little bit off from the bucket and RRDtool  
is adjusting the value to fit in the bucket based on its rate (all  
values to rrdtool are rates).

--
Marc

_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Re: RRA AVERAGE:0.5:1 undesirable result

by kssgill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Thanks Marc for the feedback.

 

Rewrote the program to rrdupdate with time stamp and results appear correct now.

 

                        <!-- 2009-10-12 20:03:40 EDT / 1255392220 --> <row><v> 4.0000000000e+00 </v></row>
                        <!-- 2009-10-12 20:04:00 EDT / 1255392240 --> <row><v> 6.0000000000e+00 </v></row>
                        <!-- 2009-10-12 20:04:20 EDT / 1255392260 --> <row><v> 8.0000000000e+00 </v></row>
                        <!-- 2009-10-12 20:04:40 EDT / 1255392280 --> <row><v> 1.0000000000e+01 </v></row>
                        <!-- 2009-10-12 20:05:00 EDT / 1255392300 --> <row><v> 1.2000000000e+01 </v></row>
                        <!-- 2009-10-12 20:05:20 EDT / 1255392320 --> <row><v> 1.4000000000e+01 </v></row>
                        <!-- 2009-10-12 20:05:40 EDT / 1255392340 --> <row><v> 1.6000000000e+01 </v></row>
                        <!-- 2009-10-12 20:06:00 EDT / 1255392360 --> <row><v> 1.8000000000e+01 </v></row>
                        <!-- 2009-10-12 20:06:20 EDT / 1255392380 --> <row><v> 2.0000000000e+01 </v></row>
                        <!-- 2009-10-12 20:06:40 EDT / 1255392400 --> <row><v> 2.2000000000e+01 </v></row>
                        <!-- 2009-10-12 20:07:00 EDT / 1255392420 --> <row><v> 2.4000000000e+01 </v></row>
                        <!-- 2009-10-12 20:07:20 EDT / 1255392440 --> <row><v> 2.6000000000e+01 </v></row>
                        <!-- 2009-10-12 20:07:40 EDT / 1255392460 --> <row><v> 2.8000000000e+01 </v></row>
                        <!-- 2009-10-12 20:08:00 EDT / 1255392480 --> <row><v> 3.0000000000e+01 </v></row>
                        <!-- 2009-10-12 20:08:20 EDT / 1255392500 --> <row><v> 3.2000000000e+01 </v></row>
                        <!-- 2009-10-12 20:08:40 EDT / 1255392520 --> <row><v> 3.4000000000e+01 </v></row>
                        <!-- 2009-10-12 20:09:00 EDT / 1255392540 --> <row><v> 3.6000000000e+01 </v></row>
                        <!-- 2009-10-12 20:09:20 EDT / 1255392560 --> <row><v> 3.8000000000e+01 </v></row>
                        <!-- 2009-10-12 20:09:40 EDT / 1255392580 --> <row><v> 4.0000000000e+01 </v></row>
                        <!-- 2009-10-12 20:10:00 EDT / 1255392600 --> <row><v> 4.2000000000e+01 </v></row>
                        <!-- 2009-10-12 20:10:20 EDT / 1255392620 --> <row><v> 4.4000000000e+01 </v></row>
                        <!-- 2009-10-12 20:10:40 EDT / 1255392640 --> <row><v> 4.6000000000e+01 </v></row>
                        <!-- 2009-10-12 20:11:00 EDT / 1255392660 --> <row><v> 4.8000000000e+01 </v></row>
                        <!-- 2009-10-12 20:11:20 EDT / 1255392680 --> <row><v> 5.0000000000e+01 </v></row>
                        <!-- 2009-10-12 20:11:40 EDT / 1255392700 --> <row><v> 5.2000000000e+01 </v></row>
                        <!-- 2009-10-12 20:12:00 EDT / 1255392720 --> <row><v> 5.4000000000e+01 </v></row>


Very interesting ... I was relying on sleep(20) for the updates to be 20sec apart which caused the average function to adjust the value.

 

 

-Kanwar
 


Date: Mon, 12 Oct 2009 15:11:14 -0700
From: ml-user+90412-1259777342@...
To: kssgill@...
Subject: Re: [rrd-users] RRA AVERAGE:0.5:1 undesirable result


On Oct 12, 2009, at 4:48 PM, kssgill wrote:


>
> Hi,  I've setup a test RRA as shown below and create a perl script  
> to popuate
> it with test data. I'm see rounding off of data which is not what I  
> was
> expecting.
>
> This is how I created an rrd file:
>
> rrdtool create testfile.rrd  -s 20 DS:await:GAUGE:40:0:10000000
> RRA:AVERAGE:0.5:1:1598400
I'm not an rrdtool expert but... You don't specify a start time so  
you're telling rrdtool to expect updates at exactly 20 second  
intervals from [the time this file is created -10 seconds]...

> my $rrdUpd = `rrdupdate testfile.rrd -t await N:$i`; chomp($rrdUpd);

This uses the current timestamp (N), which may or may not be exactly a  
20 second interval from the above start time...


> And I'm surprised to see that instead of see 2,4,6,8. The numbers are
> 2,3.7,5.7,7.7
>
> 2.0000000000e+00
> 3.7085260000e+00
> 5.7077767000e+00
> 7.7067147000e+00
>
> Not able to understand how I lost percision on the number.  From  
> reading
> online Average:0.5:1 should be the number it self.
Only if you input data on the exact timestamps that correspond to the  
buckets (steps from start) you've created in the RRD. In your case,  
your insert timestamp is a little bit off from the bucket and RRDtool  
is adjusting the value to fit in the bucket based on its rate (all  
values to rrdtool are rates).

--
Marc

_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users





View message @ http://n2.nabble.com/RRA-AVERAGE-0-5-1-undesirable-result-tp3810921p3811085.html 
To unsubscribe from RRA AVERAGE:0.5:1 undesirable result, click here.
     
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/171222986/direct/01/
--
View this message in context: http://n2.nabble.com/RRA-AVERAGE-0-5-1-undesirable-result-tp3810921p3811597.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.

_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Re: RRA AVERAGE:0.5:1 undesirable result

by Marc Powell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Oct 12, 2009, at 7:11 PM, kssgill wrote:

> Very interesting ... I was relying on sleep(20) for the updates to  
> be 20sec apart which caused the average function to adjust the value.

I don't think that sleep was the problem. It probably was right on  
most or all of the time. I expect that your problem was that your  
start time was off and you were consistently entering the data x  
number of seconds ahead or behind your buckets.
       
             buckets at 20 40 60 80 100
        data entered at 18 38 58 78 98

--
Marc

_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Re: RRA AVERAGE:0.5:1 undesirable result

by Tobias Oetiker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

Yesterday Marc Powell wrote:

>
> On Oct 12, 2009, at 4:48 PM, kssgill wrote:
>
> >
> > Hi,  I've setup a test RRA as shown below and create a perl script
> > to popuate
> > it with test data. I'm see rounding off of data which is not what I
> > was
> > expecting.
> >
> > This is how I created an rrd file:
> >
> > rrdtool create testfile.rrd  -s 20 DS:await:GAUGE:40:0:10000000
> > RRA:AVERAGE:0.5:1:1598400
>
> I'm not an rrdtool expert but... You don't specify a start time so
> you're telling rrdtool to expect updates at exactly 20 second
> intervals from [the time this file is created -10 seconds]...
>
> > my $rrdUpd = `rrdupdate testfile.rrd -t await N:$i`; chomp($rrdUpd);
>
> This uses the current timestamp (N), which may or may not be exactly a
> 20 second interval from the above start time...

note that the creation/start time of the rrd does not matter so
much ... since all 'buckets' are aligned to  1970 Jan 1st 0:00 UTC.

> > And I'm surprised to see that instead of see 2,4,6,8. The numbers are
> > 2,3.7,5.7,7.7
> >
> > 2.0000000000e+00
> > 3.7085260000e+00
> > 5.7077767000e+00
> > 7.7067147000e+00
> >
> > Not able to understand how I lost percision on the number.  From
> > reading
> > online Average:0.5:1 should be the number it self.
>
> Only if you input data on the exact timestamps that correspond to the
> buckets (steps from start) you've created in the RRD. In your case,
> your insert timestamp is a little bit off from the bucket and RRDtool
> is adjusting the value to fit in the bucket based on its rate (all
> values to rrdtool are rates).

if you want to to see the same data you entered in the buckt, you
have to drop the data on the right (future) rim of the bucket ...

cheers
tobi
--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi@... ++41 62 775 9902 / sb: -9900

_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Re: RRA AVERAGE:0.5:1 undesirable result

by Marc Powell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Oct 13, 2009, at 1:04 AM, Tobias Oetiker wrote:

> Hi All,
>
> Yesterday Marc Powell wrote:

>> This uses the current timestamp (N), which may or may not be  
>> exactly a
>> 20 second interval from the above start time...
>
> note that the creation/start time of the rrd does not matter so
> much ... since all 'buckets' are aligned to  1970 Jan 1st 0:00 UTC.

Thanks for the clarification Tobi.

--
Marc

_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users