[rrd-users] merging 2 or more DEF data sources into one CDEF?
Simon Hobson
linux at thehobsons.co.uk
Fri Apr 11 20:21:59 CEST 2008
Ryan Kubica wrote:
>What I am trying to do is take two or more datasources with
>different time ranges and merge them into one CDEF for display
>(graph and legend.)
>
>Example:
>
> ds foo1 - start 7 days ago, end 6 days ago
> ds foo2 - start 6 days ago, end 5 days ago
> ds foo3 - start 5 days ago, end now
>
> cdef is foo1 or foo2 or foo3
>
>I have the correct time alignments for the adjacent time intervals,
>ie: foo1 ends 60 seconds before foo2 starts on a 60 second interval
>step.
OK, for two data sources I have this in a graph definition :
DEF:data1=${RRDPath1}/${RRDName1}:${Selection}:AVERAGE
DEF:data2=${RRDPath2}/${RRDName2}:${Selection}:AVERAGE
CDEF:data=TIME,${ChangeDate},LT,data1,data2,IF
It's part of a shell script, so using normal Bash variable sustitutions.
For three sources just expand as required, I think this would do it
(with the proviso that changedate2>changedate1) :
CDEF:data=TIME,${ChangeDate1},LT,data1,TIME,${ChangeDate2},LT,data2,data3,IF,IF
More information about the rrd-users
mailing list