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.
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. 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. Long ________________________________ From: Tobias Oetiker <t...@oetiker.ch> To: Long <long_at_w...@yahoo.ca> Cc: rrd-developers@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 Function? 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 ... cheers tobi > > 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: >http://rrd-mailinglists.937164.n2.nabble.com/How-to-create-a-new-Data-Type-and-Consolidation-Function-tp5990330p6251263.html > > Sent from the RRDtool Developers Mailinglist mailing list archive at >Nabble.com. > > _______________________________________________ > rrd-developers mailing list > rrd-developers@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 t...@oetiker.ch ++41 62 775 9902 / sb: -9900
_______________________________________________ rrd-developers mailing list rrd-developers@lists.oetiker.ch https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers