[rrd-users] Help with RPN: divide the sum of two sets

Steve Shipway s.shipway at auckland.ac.nz
Wed Dec 15 05:50:31 CET 2010


CDEF:cost=bysize400,bysize200,+,bycount400,bycount200,+,/

This should work; however you might get somehting odd if any of the variables are UNKN or INF.  Are you ABSOLUTELY sure that there are no unknowns in there?  You might be getting an unknown out at the end and then graphing it as a zero.  Also, if bysize400 and bysize200 come from separate RRD files that are not updated simultaneously, you might get a bit of a race condition on the final datapoint in your graph, though this might not bother you.  Using PREV can help avoid this.
 
You could use a more complex function to ensure no unknowns in components:

CDEF:cost=bysize400,UN,0,bysize400,IF,bysize200,UN,0,bysize200,IF,+,bycount400,UN,0,bycount400,IF,bycount200,UN,0,bycount200,IF,+,/

if you have a more recent version of RRDTool, you can use ADDNAN, which is neater:

CDEF:cost=bysize400,bysize200,ADDNAN,bycount400,bycount200,ADDNAN,/

Steve

Steve Shipway
University of Auckland ITS
UNIX Systems Design Lead
s.shipway at auckland.ac.nz
Ph: +64 9 373 7599 ext 86487






More information about the rrd-users mailing list