[rrd-users] Aggregation functions for combining whole data sets or averaging over many RRDs

Carsten Aulbert carsten at welcomes-you.com
Sun Mar 23 12:44:21 CET 2008


Hi,

I don't know which title would the perfect one for this problem, please 
read on:

Assuming I have many RRD files filled with a few RRA/channels like this one:

RRDs::create ( "lcp001-Water.rrd",
                 "--start=$starttime",
                 "--step=60",
                 "DS:TotPow:GAUGE:120:0:50000",
                 "DS:WatFlow:GAUGE:120:0:200",
                 "DS:Valve:GAUGE:120:0:100",
                 "DS:WatIn:GAUGE:120:0:100",
                 "DS:WatOut:GAUGE:120:0:100",
                 "RRA:AVERAGE:0.5:1:$rrd_steps"
               );

 From these I can easily retrieve a time series or generate a graph. 
However, I would like to use many (24) of these time series and would 
like to average the values for each single time stamp. Thus I would like 
to use the AVERAGE function for a CDEF, which seems not to be allowed 
(or I don't know how to do it). Right now I do it like this, which looks 
pretty ugly to me:

rrdtool graph test.png --width=1200 --height=200 --start=20080101 
--vertical-label "Water in [C]" \
     DEF:watin001=/tmp/lcp-001-Water.rrd:WatIn:AVERAGE  \
     DEF:watin002=/tmp/lcp-002-Water.rrd:WatIn:AVERAGE  \
     DEF:watin003=/tmp/lcp-003-Water.rrd:WatIn:AVERAGE  \
     DEF:watin004=/tmp/lcp-004-Water.rrd:WatIn:AVERAGE  \
     DEF:watin005=/tmp/lcp-005-Water.rrd:WatIn:AVERAGE  \
     DEF:watin006=/tmp/lcp-006-Water.rrd:WatIn:AVERAGE  \
     DEF:watin007=/tmp/lcp-007-Water.rrd:WatIn:AVERAGE  \
     DEF:watin008=/tmp/lcp-008-Water.rrd:WatIn:AVERAGE  \
     DEF:watin009=/tmp/lcp-009-Water.rrd:WatIn:AVERAGE  \
     DEF:watin010=/tmp/lcp-010-Water.rrd:WatIn:AVERAGE  \
     DEF:watin011=/tmp/lcp-011-Water.rrd:WatIn:AVERAGE  \
     DEF:watin012=/tmp/lcp-012-Water.rrd:WatIn:AVERAGE  \
     DEF:watin013=/tmp/lcp-013-Water.rrd:WatIn:AVERAGE  \
     DEF:watin014=/tmp/lcp-014-Water.rrd:WatIn:AVERAGE  \
     DEF:watin015=/tmp/lcp-015-Water.rrd:WatIn:AVERAGE  \
     DEF:watin016=/tmp/lcp-016-Water.rrd:WatIn:AVERAGE  \
     DEF:watin017=/tmp/lcp-017-Water.rrd:WatIn:AVERAGE  \
     DEF:watin018=/tmp/lcp-018-Water.rrd:WatIn:AVERAGE  \
     DEF:watin019=/tmp/lcp-019-Water.rrd:WatIn:AVERAGE  \
     DEF:watin020=/tmp/lcp-020-Water.rrd:WatIn:AVERAGE  \
     DEF:watin021=/tmp/lcp-021-Water.rrd:WatIn:AVERAGE  \
     DEF:watin022=/tmp/lcp-022-Water.rrd:WatIn:AVERAGE  \
     DEF:watin023=/tmp/lcp-023-Water.rrd:WatIn:AVERAGE  \
     DEF:watin024=/tmp/lcp-024-Water.rrd:WatIn:AVERAGE  \
 
CDEF:preavg=watin001,watin002,watin003,watin004,watin005,watin006,watin007,watin008,watin009,watin010,watin011,watin012,watin013,watin014,watin015,watin016,watin017,watin018,watin019,watin020,watin021,watin022,watin023,watin024,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+ 
\
     CDEF:avg=preavg,24,/ \
     "LINE1:avg#FF0000"

Is there a better way to do it?

TIA

Carsten



More information about the rrd-users mailing list