From: Alexey Remizov Date: Fri, 22 Aug 2014 07:02:47 +0000 (+0400) Subject: allow to configure the maximum effective interval between attempts to read data by... X-Git-Tag: collectd-5.5.0~206^2~6 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=29d4188c1d4305bb06bceb66224035130d8e0a38;p=collectd.git allow to configure the maximum effective interval between attempts to read data by plugins --- diff --git a/src/configfile.c b/src/configfile.c index d2a307d9..8c5ecdfc 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -118,7 +118,8 @@ static cf_global_option_t cf_global_options[] = {"Timeout", NULL, "2"}, {"AutoLoadPlugin", NULL, "false"}, {"PreCacheChain", NULL, "PreCache"}, - {"PostCacheChain", NULL, "PostCache"} + {"PostCacheChain", NULL, "PostCache"}, + {"MaxEffectiveInterval", NULL, "86400"} }; static int cf_global_options_num = STATIC_ARRAY_SIZE (cf_global_options); diff --git a/src/plugin.c b/src/plugin.c index 30a1ff1a..84073189 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -482,9 +482,14 @@ static void *plugin_read_thread (void __attribute__((unused)) *args) * intervals in which it will be called. */ if (status != 0) { + const char *mei = global_option_get ("MaxEffectiveInterval"); + int max_effective_interval = atoi (mei); + if (max_effective_interval <= 0) { + max_effective_interval = 86400; + } rf->rf_effective_interval *= 2; - if (rf->rf_effective_interval > TIME_T_TO_CDTIME_T (86400)) - rf->rf_effective_interval = TIME_T_TO_CDTIME_T (86400); + if (rf->rf_effective_interval > TIME_T_TO_CDTIME_T (max_effective_interval)) + rf->rf_effective_interval = TIME_T_TO_CDTIME_T (max_effective_interval); NOTICE ("read-function of plugin `%s' failed. " "Will suspend it for %.3f seconds.",