[rrd-developers] How to create a new Data Type and Consolidation Function?
tobi at oetiker.ch
Mon Apr 11 09:32:43 CEST 2011
Friday Long V wrote:
> Hi Tobi,
> As I explained earlier in this same thread, I needed a solution for Cacti to be
> able to sum up the difference between 2 counter readings.
seems a bit extreem to hack something so alien into rrdtool instead
of fixing cacti, but there you go ...
> Since DST_COUNTER is a rate, I had to create DST_DIFFERENCE that does exactly
> what DST_COUNTER does without the division by the step period.
> Also since there was no CF_SUM to do the sum, I had to create one.
> I know that I could write a CDEF to multiply CF_AVERAGE by the step period to
> get the sum, but that would only fix my problem for one level of consolidation
> because I can only associate one CDEF per DS in Cacti.
> So let say I poll every minute, and my DS has 3 RRA, RRA1 has step 1, RRA2 has
> step 5 (5 mins average) and RRA3 has step 30 (30 mins average). Associating a
> CDEF to multiply by 60 will only fix my RRA1 from per second to per minute
> measurement. RRA2 and RRA3 will stay at per minute while I want them per 5
> minutes and per 30 minutes.
> Cacti is basically a web UI wrapper on top of RRDTool. All calculations is done
> at RRDTool level so that's why I choose to do this fix at RRDTool level instead
> of at Cacti's level. Also doing this fix at RRDTool level will enable this
> functionality for more than just Cacti's users. Anyone doing another wrapper on
> top of RRDTool will also benefit.
that is exacly what makes me un-easy about your change ...
RRAs witth different step size should still contain the same
essential data ... just at a different resolution ... with your
function this core premise of rrdtool gets pierced ...
> As for the regression test I wrote to test my code, here's a brief explanation
> of what I've tested.
> I create a RRD file with all the existing DST (COUNTER, DERIVE, ABSOLUTE, GAUGE)
> and all the existing "primary" CF (AVERAGE, MIN, MAX, LAST) with 3 RRA each
> (step 1, step 3, step 9).
> Then I used updatev to do the update so I can see the calculated values.
> I forced interpolation by updating at 61 sec interval instead of at exactly the
> step size 60.
> The create command use a fixed --start that I increment by 0, 1, 2, ... , 60,
> 120, 180, ... 540 (so 60 iteration with 1 sec increment (change unknown_sec) and
> 9 iteration with 1 min increment (change unknown_datapoints)).
> I loop all the iterations, save the output and redo the same with my newly
> recompiled rrdtool binaries, diff the output, they are identical. So I know I
> didn't introduce any regression in existing DST and CF.
I am not so much worried about you breaking the existing code.
Have you also added code to rrd_graph to properly resample based on
the SUM consolidation function ?
what additions to the documentation have you made to explain the
exotic properties of your new DST and CF ?
> From: Tobias Oetiker <tobi at oetiker.ch>
> To: Long <long_at_work at yahoo.ca>
> Cc: rrd-developers at lists.oetiker.ch
> Sent: Thu, April 7, 2011 4:56:18 PM
> Subject: Re: [rrd-developers] How to create a new Data Type and Consolidation
> Hi Long,
> Today Long wrote:
> > Hi,
> > I've completed adding a DST called DIFFERENCE and a CF called SUM.
> > I've done some regression test on my side and they all look fine.
> the question might be more 'what they do' than whether they do it
> correctly ... maybe write a bit about that ...
> > Is there's any official regression test suite I should run my code through
> > before submitting the patch?
> > Thanks,
> > Long
> > --
> > View this message in context:
> > Sent from the RRDtool Developers Mailinglist mailing list archive at
> > _______________________________________________
> > rrd-developers mailing list
> > rrd-developers at lists.oetiker.ch
> > https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900
More information about the rrd-developers