[collectd] Custom RRAs when creating RRD file
kgardenia42
kgardenia42 at googlemail.com
Tue Mar 27 19:09:40 CEST 2012
Hi,
I am trying to port some straight rrdtool code to use collectd (4.10.x).
This is the rrdtool create command being used historically:
rrdtool create ${name} --start ${timestamp} --step=5 \
DS:rx_bytes:COUNTER:600:0:${UPPER_LIMIT_BYTES} \
DS:tx_bytes:COUNTER:600:0:${UPPER_LIMIT_BYTES} \
RRA:AVERAGE:0.5:1:100 \
RRA:AVERAGE:0.5:6:100 \
RRA:AVERAGE:0.5:12:50 \
RRA:AVERAGE:0.5:120:50 \
RRA:AVERAGE:0.5:720:24 \
RRA:AVERAGE:0.5:17280:7
So, as I understand it this pre-defines some AVERAGE aggregates for
different buckets which can be retrieved later.
My question is: how can I accomplish the same thing the "collectd" way?
Firstly, I'll outline what I've done:
* I made a types.db entry for the 2 counter fields, so that when I
start doing "PUTVAL" calls in my plugin the right fields will be
created in the file.
* In my plugin I'm writing the values as follows:
echo "PUTVAL $HOSTNAME/$category/foo interval=$INTERVAL
N:${rx_bytes}:${tx_bytes}"
ok - so far so good. That seems to do the right thing. If the rrd
file does not exist then the first PUTVAL in my plugin creates it and
starts populating the (multiple) fields.
What this does not give me is the RRAs I historically had. To get
those I tried messing around with RRARows, RRATimespan etc in the
<Plugin rrdtool> definition. This seems to be roughly what I want (in
that adding new RRARows entries seems to add new RRAs to the resulting
RRD file) but no matter what I try I can't get it to make a RRD file
with he same "buckets" as the original RRD (see above). Am I on the
right track with RRARows, RRATimespan etc? Is the granularity of
control even there to do what I'm trying to do (using RRARows,
RRATimespan) ?
Another approach I tried was to manually create the RRD myself (using
rrdtool create) and then try to update it with PUTVAL. However, this
did not appear to do the right thing. Should I have expected that
approach to work?
Would I have more control of how the RRAs are created in the RRD if I
were to write my plugin in perl or C rather than using PUTVAL from a
shell script?
Generally, I'd just like to know what I can do to accomplish my goal
using best practice.
Thanks.
More information about the collectd
mailing list