[rrd-users] Re: problems summing many sources together

Georges Toth georges at norm.lu
Wed Jun 7 18:19:52 MEST 2006


> you need to add an IF directive there which returns data or zero if 
undefined:
> | CDEF:mycdef=mydef,UN,0,mydef,IF

Thanks a lot !
That did the trick :-).

I tried two different approaches.
First one is to define 21 times this:
	CDEF:in_1=in1,UN,0,in1,IF
	CDEF:out_1=out1,UN,0,out1,IF
and then sum it like this:
	CDEF:intot=in_1,in_2,+,in_3,+,in_4,+,in_5,+,in_6,+,in_7,+,in_8,+,in_9,
+,in_10,+,in_11,+,in_12,+,in_13,+,in_14,+,in_15,+,in_16,+,in_17,+,in_18,
+,in_19,+,in_20,+,in_21,+ 
	CDEF:outtot=out_1,out_2,+,out_3,+,out_4,+,out_5,+,out_6,+,out_7,+,out_8,
+,out_9,+,out_10,+,out_11,+,out_12,+,out_13,+,out_14,+,out_15,+,out_16,
+,out_17,+,out_18,+,out_19,+,out_20,+,out_21,+


Second one was like you suggested (but I only read that when I already tried 
the first one...):

CDEF:intot=in1,UN,0,in1,IF,in1,UN,0,in1,IF,in2,UN,0,in2,IF,in3,UN,0,in3,IF,in4,UN,0,in4,IF,in5,UN,0,in5,IF,in6,UN,0,in6,IF,in7,UN,0,in7,IF,in8,UN,0,in8,IF,in9,UN,0,in9,IF,in10,UN,0,in10,IF,in11,UN,0,in11,IF,in12,UN,0,in12,IF,in13,UN,0,in13,IF,in14,UN,0,in14,IF,in15,UN,0,in15,IF,in16,UN,0,in16,IF,in17,UN,0,in17,IF,in18,UN,0,in18,IF,in19,UN,0,in19,IF,in20,UN,0,in20,IF,in21,UN,0,in21,IF,
+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+
CDEF:outtot=out1,UN,0,out1,IF,out2,UN,0,out2,IF,out3,UN,0,out3,IF,out4,UN,0,out4,IF,out5,UN,0,out5,IF,out6,UN,0,out6,IF,out7,UN,0,out7,IF,out8,UN,0,out8,IF,out9,UN,0,out9,IF,out10,UN,0,out10,IF,out11,UN,0,out11,IF,out12,UN,0,out12,IF,out13,UN,0,out13,IF,out14,UN,0,out14,IF,out15,UN,0,out15,IF,out16,UN,0,out16,IF,out17,UN,0,out17,IF,out18,UN,0,out18,IF,out19,UN,0,out19,IF,out20,UN,0,out20,IF,out21,UN,0,out21,IF,
+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+


I'm wondering which one is better / faster ?

Also, is there no more efficient solution for doing this ?


Thnx

-- 

regards,
Georges Toth

--
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