[rrd-users] Strange behavior when using CDEF to divide two values

Wesley PA4WDH pa4wdh at yahoo.com
Sun Feb 17 13:53:00 CET 2013


Hi Alex,

At least i thought i did understand :-)
I also see that the values stored in the RRD databases are not the exact values i store in it, as far as i know a result of normalisation.

The part i do not understand is that it may occour during graphing. The two datasources are stored in the same database and normalized so i wouldn't expect any normalization during graphing.

I don't think consolidation will have any role in this situation since i'm only using one RRA to store a day of 5-minute samples, not the data is not consolidated any further.

Please correct me if i'm wrong :-)

Best regards,
Wesley

--- On Sun, 2/17/13, Alex van den Bogaerdt <alex at vandenbogaerdt.nl> wrote:

> From: Alex van den Bogaerdt <alex at vandenbogaerdt.nl>
> Subject: Re: [rrd-users] Strange behavior when using CDEF to divide two values
> To: rrd-users at lists.oetiker.ch
> Date: Sunday, February 17, 2013, 11:57 AM
> Without diving deep into this
> problem, the first thing that pops up in my 
> mind is:
> 
> Do you know about, and understand, data normalization and
> consolidation?
> 
> http://rrdtool.vandenbogaerdt.nl/process.php
> 
> Be aware that consolidation-like behaviour may also occur
> while graphing, so 
> the number of horizontal pixels vs. the number of time slots
> does affect the 
> outcome.
> 
> cheers,
> Alex
> 
> ----- Original Message ----- 
> From: "Wesley PA4WDH" <pa4wdh at yahoo.com>
> To: <rrd-users at lists.oetiker.ch>
> Sent: Sunday, February 17, 2013 11:13 AM
> Subject: [rrd-users] Strange behavior when using CDEF to
> divide two values
> 
> 
> > Hi All,
> >
> > I'm running some rrdtool data collection and i see some
> strange behavior 
> > when i try to divide two DS's with a CDEF.
> >
> > I'm collecting the length of traffic jams and the
> number of traffic jams 
> > in my country and store them in a rrd database. All is
> well and graphs 
> > look good. Now i would like to calculate the average
> length by dividing 
> > the total length with the number. I thought this would
> be easy by just 
> > writing a CDEF:AVG=LENGTH,COUNT,/ line and graphing AVG
> ... but how wrong 
> > could i be .. :-)
> >
> > First i got a lot of high spikes in my graph. I noticed
> this happened when 
> > the "COUNT" was 0, so actually a division by zero. I
> thought this would 
> > render to NaN but it didn't :-) I solved this by
> storing NaN in the rrd 
> > when the value is 0. Are there any other/better
> solutions ?
> >
> > Now the graph looks nice but the value isn't correct. I
> saved some files 
> > for you to see: http://ernstagn.home.xs4all.nl/rrd/
> > Here you see the three graphs (length number and
> average) and dump.xml is 
> > a "rrdtool dump" xml of the database.
> > You can see that the value plotted for the average is
> not correct given 
> > the input values. For example at 11:00 at the left of
> the graph: Total 
> > length was 12km, and the number was 4, so the average
> should be 3. 
> > However, the average graph plots at about 1.7.
> > During midnight there is a similar example: There are 4
> traffic jams of 
> > about 8km, but the average hardly plots above 0.
> > I've tried with "length" and "count" swapped in the
> RPN, but that didn't 
> > work out either.
> >
> > Just to make sure i'm not making any mistake with the
> calculation i tried 
> > to make an awk script which does the same with an xml
> export and there i 
> > get the values i'd expect.
> >
> > Does anyone know how to solve this ? I'm using rrdtool
> version 1.4.7.
> 
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
> 



More information about the rrd-users mailing list