[rrd-users] adding DS values from multiple rrd files?

Simon Hobson linux at thehobsons.co.uk
Wed Sep 8 21:35:08 CEST 2010


>Joel Brooks wrote:
>  I'm trying to create a graph that uses a datasource from a number of
>  different rrd files to show total items in the queue.
>
>  I have the graph working, but I want to add a legend item that shows the
>  total.
>
>  right now, the graph (a stacked graph) shows a different band for each
>  server and the legend displays the text "<server name> <X>  messages in
>  the queue".
>
>  but how can i add up all the values so i can print "total <X> messages
>  in the queue"?

CDEF:sum=a,b+,c+,d+

If any of those could be unknown and you still want to get an answer, 
then you might want :

CDEF:sum=a,UN,0,a,IF,b,UN,0,b,IF,+,c,UN,0,c,IF,+, ...

which means :
if a is unknown, then use 0 else use a
if b is unknown, then use 0 else use b
add the previous values (a and b)
if c is unknown, then use 0 else use c
add the previous values (a+b and c)
... rinse and repeat as required.

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