[rrd-users] Re: Cumulative totals

Alex van den Bogaerdt alex at ergens.op.het.net
Tue Dec 5 15:07:11 MET 2006


On Tue, Dec 05, 2006 at 11:39:57AM +0000, Ollie Maitland wrote:


> DS:Registrations2007:GAUGE:86400:0:1000
> DS:TotalReg:COMPUTE:Registrations2007,PREV(TotalReg),+

This isn't right.

> I have also tried:
> 
> CDEF:TotalReg=TotalReg,PREV(Registrations2007),+

This is closer.  However, you fail to see that
PREV(Registrations2007) starts out as an unknown (the first
time it is run refers to data outside the interval). Because
<something>+<unknown> equals <unknown>, you end up adding
unknowns each time.

You don't need PREV(...), you can use PREV  (without the brackets)
to find the previous value.

Try changing unknown into zero; something like

PREV,UN,0,PREV,IF

This results in:
  if the previous value was unknown
     push zero on the stack
  else
     push the previous value on the stack

Then add the current value of Registrations2007:
PREV,UN,0,PREV,IF,Registrations2007,+

This will reset to zero each time Registrations2007 was unknown
in the previous round.  If you don't want this, alter unknowns
for Registrations2007 into zero as well.

-- 
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/

--
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://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list