# [rrd-developers] How to create a new Data Type and Consolidation Function?

Long V long_at_work at yahoo.ca
Tue Apr 12 21:06:40 CEST 2011

```----- Original Message ----

> From: Dan Cech <dcech at phpwerx.net>
> To: rrd-developers at lists.oetiker.ch
> Sent: Tue, April 12, 2011 2:02:25 PM
> Subject: Re: [rrd-developers] How to create a new Data Type and Consolidation
>Function?
>
> Back up a second, for a regular COUNTER the rate is just the raw
> difference divided by the time delta, so you can construct your
> cumulative difference data from the AVERAGE easily with a  CDEF.
>
> Assuming a 60 second step:
>
> time            ___0 ___1 ___2 ___3 ___4 ___5 ___6 ___7 ___8
> counter_value  ___0  _300 _450 _450 _900 1200 1800 2100 2550
> rate1                ___5 _2.5 ___0 _7.5 ___5 __10 ___5 _7.5
> rate1 *  60          _300 _150 ___0 _450 _300 _600 _300  _450
> rate2                   3.75      3.75     _7.5        6.25
> rate2 * 120            _450       _450     _900       _750
> rate3                        3.75                 6.875
> rate3 * 240                  _900                 _1650
>

Hi Dan, you are correct.

But using a CDEF to alter the data implies you need to know which RRA will the
time range trigger (when you want to zoom-in the data).

Example: assume resolution 1 we keep 4 PDP. Resolution 2 we keep 4 CDP. Then if
our zoom time range is time 5 to 8 then it'll trigger res_1 so we have to
multiply by 60. If our zoom time range is time 1 to 8 then it'll trigger res_2
and we have to know it's res_2 so we have to multiply by 120 instead of 60.

With Cacti, we can only associate one single CDEF per DS no matter how many RRA
this DS has. The CDEF is static. So already with multiple RRA, we need to at
least have one corresponding CDEF per RRA to re-multiply by the proper step size
of the RRA.

When zooming, Cacti just generate the time range and feed it to rrd_graph. Cacti
can also pass a CDEF to rrd_graph. But there's only 1 CDEF per DS. Even if we
had one CDEF per RRA (so many CDEF per DS), Cacti still has no way of knowing
which CDEF to give because it doens't know which RRA will be triggered by the
time range.

Long

>
> What am I missing  here?
>
> Dan

```