[collectd] RRD and RRA specific definition

Yves Mettier ymettier at free.fr
Fri Nov 29 14:48:12 CET 2013


Hello,

This is about how RRD files are created when we need specific RRA.

Old need
--------

I had a need to create a RRD with a specific RRA :
- timespan 1 year
- average only (because I do not need min and max and they take space on 
my disk)

I solved that problem with a patch to have only AVERAGE and with that 
config line :
RRA AVERAGE (this is my patch, PullRequest #277)
RRATimespan 31622400
That works because the 1st RRATimespan has a pdp_per_row forced to 1 
(seen in the source code).

New need
--------
Now I have a new need, with different sources and different intervals, 
like 10 or 60 seconds :
- 1 RRA with average only, timespan = 1 week, best precision (e.g. 
pdp_per_row=1)
- 1 RRA with average only, timespan = 1 year, precision = 60 seconds.

With collectd-5.4, there is no way to do it. So I reworked rrdtool.c and 
rrdcached.c (and utils_rrd...*).
I updated my PullRequest : #277. There is a new keyword RRADef.

Syntax :
RRADef <timespan> <pdp_per_row> <precision> <rra type> [<rra type> [<rra 
type>]] <xff>

Example (for my need) :
RRADef 604800 1 0 AVERAGE
RRADef 31622400 0 60 AVERAGE

With 1st line, I define 1 RRA "AVERAGE" for 7 days with 1 pdp_per_row 
(best precision because it depends on the interval).
With 2nd line, I define 1 RRA "AVERAGE" for 1 year with pdp_per_row 
computed as (60 / interval) so it does not depend on the interval.

Note : all arguments are optional except timespan. Either do not write 
it if it at the end, or set 0 (or "default" for the rra type). Precision 
is ignored if pdp_per_row is not nul.

There is more information in collectd.pod.

When I was looking for a solution, Google told me that I was not the 
only one to have that kind of needs. But no solution was provided.



Question for @Octo and core developers : is RRADef the best keyword ? 
Maybe I should extend the use of RRATimespan instead ?

For example, the 2 following lines are equivalent :
RRATimespan 12345
RRADef 12345

Note for @Octo and core developers : for this patch, I had to factorize 
code between rrdtool.c and rrdcached.c and I put it in 
utils_rrdcreate.c. Why was that code (rrd_config() and rc_config() ) 
duplicated in a so strange way ?

Regards,
Yves


-- 
- Homepage       - http://ymettier.free.fr                             -
- GPG key        - http://ymettier.free.fr/gpg.txt                     -
- C en action    - http://ymettier.free.fr/livres/C_en_action_ed2.html -
- Guide Survie C - http://www.pearson.fr/livre/?GCOI=27440100673730    -



More information about the collectd mailing list