From: Florian Forster Date: Sat, 10 Nov 2012 09:08:35 +0000 (+0100) Subject: rrdcached plugin: Implement the "XFF" option. X-Git-Tag: collectd-5.2.0~26 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a23f5e30270016b7d0eefc340c96081f3e9dd029;p=collectd.git rrdcached plugin: Implement the "XFF" option. --- diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 9a670681..d7aba7bc 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -4233,6 +4233,12 @@ more then one RRA. If this option is never used, the built-in default of (3600, For more information on how RRA-sizes are calculated see B above. +=item B I + +Set the "XFiles Factor". The default is 0.1. If unsure, don't set this option. +I must be in the range C<[0.0-1.0)>, i.e. between zero (inclusive) and +one (exclusive). + =back =head2 Plugin C @@ -4290,6 +4296,8 @@ For more information on how RRA-sizes are calculated see B above. =item B I Set the "XFiles Factor". The default is 0.1. If unsure, don't set this option. +I must be in the range C<[0.0-1.0)>, i.e. between zero (inclusive) and +one (exclusive). =item B I diff --git a/src/rrdcached.c b/src/rrdcached.c index 3731d010..8dd636c2 100644 --- a/src/rrdcached.c +++ b/src/rrdcached.c @@ -176,6 +176,29 @@ static int rc_config_get_int_positive (oconfig_item_t const *ci, int *ret) return (0); } /* int rc_config_get_int_positive */ +static int rc_config_get_xff (oconfig_item_t const *ci, double *ret) +{ + double value; + + if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_NUMBER)) + { + ERROR ("rrdcached plugin: The \"%s\" needs exactly one numeric argument " + "in the range [0.0, 1.0)", ci->key); + return (EINVAL); + } + + value = ci->values[0].value.number; + if ((value => 0.0) && (value < 1.0)) + { + *ret = value; + return (0); + } + + ERROR ("rrdcached plugin: The \"%s\" needs exactly one numeric argument " + "in the range [0.0, 1.0)", ci->key); + return (EINVAL); +} /* int rc_config_get_xff */ + static int rc_config_add_timespan (int timespan) { int *tmp; @@ -242,6 +265,8 @@ static int rc_config (oconfig_item_t *ci) if (status == 0) status = rc_config_add_timespan (tmp); } + else if (strcasecmp ("XFF", key) == 0) + status = rc_config_get_xff (child, &rrdcreate_config.xff); else { WARNING ("rrdcached plugin: Ignoring invalid option %s.", key);