[rrd-users] Things not adding up

Simon Hobson linux at thehobsons.co.uk
Tue Apr 5 17:39:20 CEST 2011


Jared Watkins wrote:

>I'm most interested in the max values for this data and if you add 
>up all the individual max values you get a value that's 120.15 
>greater than the total printed on the graph both visually and in the 
>gprints.

In general you cannot add max values. Consider this (contrived) 
scenario. You have four data sets, and get PDP values like this :

  A  B  C  D
10  0  0  0
  0 10  0  0
  0  0 10  0
  0  0  0 10

Now it's clear to see that at no time does the combined set of values 
exceed 10. Now lets consolidate those into one MAX CDP :

  A  B  C  D
10 10 10 10

So now if we add them, the result is 40 - very clearly wrong ! 
Similarly, if we consolidated with a MIN function and added them up, 
we'd end up with zero which is also obviously wrong.

On the other hand, if we consolidate them with Average, we get :

   A   B   C   D
2.5 2.5 2.5 2.5

Adding those does indeed get us to the 10 that we might expect.

If you were wanting the maximum value of the total then you would be 
better to store the sum along with your base data :

  A  B  C  D SUM
10  0  0  0  10
  0 10  0  0  10
  0  0 10  0  10
  0  0  0 10  10

Now if we consolidate that with a MAX function, MAX(SUM) comes to 10 
which is what you may be looking for.

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.



More information about the rrd-users mailing list