From 7e79fd8e02abb6ad01c97a7a36fdb73a8fb097cd Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 10 Nov 2012 09:50:22 +0100 Subject: [PATCH] rrdcached plugin: Implement the "StepSize", "HeartBeat" and "RRARows" options. --- src/collectd.conf.pod | 30 ++++++++++++++++++++++++++++++ src/rrdcached.c | 21 +++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index e24282c3..25a6c06e 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -4195,6 +4195,36 @@ Enables or disables the creation of RRD files. If the daemon is not running locally, or B is set to a relative path, this will not work as expected. Default is B. +=item B I + +B the stepsize of newly created RRD-files. Ideally (and per default) +this setting is unset and the stepsize is set to the interval in which the data +is collected. Do not use this option unless you absolutely have to for some +reason. Setting this option may cause problems with the C, the +C or when the daemon is set up to receive data from other hosts. + +=item B I + +B the heartbeat of newly created RRD-files. This setting should be unset +in which case the heartbeat is set to twice the B which should equal +the interval in which data is collected. Do not set this option unless you have +a very good reason to do so. + +=item B I + +The C calculates the number of PDPs per CDP based on the +B, this setting and a timespan. This plugin creates RRD-files with +three times five RRAs, i. e. five RRAs with the CFs B, B, and +B. The five RRAs are optimized for graphs covering one hour, one day, one +week, one month, and one year. + +So for each timespan, it calculates how many PDPs need to be consolidated into +one CDP by calculating: + number of PDPs = timespan / (stepsize * rrarows) + +Bottom line is, set this no smaller than the width of you graphs in pixels. The +default is 1200. + =back =head2 Plugin C diff --git a/src/rrdcached.c b/src/rrdcached.c index ab8d8171..a3dff3e9 100644 --- a/src/rrdcached.c +++ b/src/rrdcached.c @@ -161,6 +161,21 @@ static int value_list_to_filename (char *buffer, int buffer_len, return (0); } /* int value_list_to_filename */ +static int rc_config_get_int_positive (oconfig_item_t const *ci, int *ret) +{ + int status; + int tmp = 0; + + status = cf_util_get_int (ci, &tmp); + if (status != 0) + return (status); + if (tmp < 0) + return (EINVAL); + + *ret = tmp; + return (0); +} /* int rc_config_get_int_positive */ + static int rc_config (oconfig_item_t *ci) { int i; @@ -194,6 +209,12 @@ static int rc_config (oconfig_item_t *ci) status = cf_util_get_boolean (child, &config_create_files); else if (strcasecmp ("CollectStatistics", key) == 0) status = cf_util_get_boolean (child, &config_collect_stats); + else if (strcasecmp ("StepSize", key) == 0) + status = rc_config_get_int_positive (child, &rrdcreate_config.stepsize); + else if (strcasecmp ("HeartBeat", key) == 0) + status = rc_config_get_int_positive (child, &rrdcreate_config.heartbeat); + else if (strcasecmp ("RRARows", key) == 0) + status = rc_config_get_int_positive (child, &rrdcreate_config.rrarows); else { WARNING ("rrdcached plugin: Ignoring invalid option %s.", key); -- 2.30.2