From: Yves Mettier Date: Tue, 26 Aug 2014 11:02:49 +0000 (+0200) Subject: renamed the option to CollectInternalStats; renamed 'internal' to 'collectd'; no... X-Git-Tag: collectd-5.5.0~204^2~1^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b2d20f9fa0735b15041bb4583a0ae16289cb717a;p=collectd.git renamed the option to CollectInternalStats; renamed 'internal' to 'collectd'; no more lock when not recording internal stats --- diff --git a/src/collectd.conf.in b/src/collectd.conf.in index f4a31129..1c051a06 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -28,7 +28,7 @@ # When enabled, some internal statistics are recorded as values # # Disabled by default. # #----------------------------------------------------------------------------# -#InternalStatistics false +#CollectInternalStats false #----------------------------------------------------------------------------# # Interval at which to query values. This may be overwritten on a per-plugin # diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index ba9b6cae..f379ccae 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -222,7 +222,7 @@ on the I information contained in each value list. This is used in the I configuration to dispatch notifications about missing values, see L for details. -=item B I +=item B I Some internal statistics can be recorded to monitor Collectd itself. Default value : false. diff --git a/src/configfile.c b/src/configfile.c index c0999709..2eaaad1a 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -117,7 +117,7 @@ static cf_global_option_t cf_global_options[] = {"WriteQueueLimitLow", NULL, NULL}, {"Timeout", NULL, "2"}, {"AutoLoadPlugin", NULL, "false"}, - {"InternalStatistics", NULL, "false"}, + {"CollectInternalStats", NULL, "false"}, {"PreCacheChain", NULL, "PreCache"}, {"PostCacheChain", NULL, "PostCache"} }; diff --git a/src/plugin.c b/src/plugin.c index 0b915613..ce2fb553 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -155,7 +155,7 @@ static void plugin_update_internal_statistics (void) { /* {{{ */ vl.values_len = 2; vl.time = 0; sstrncpy (vl.host, hostname_g, sizeof (vl.host)); - sstrncpy (vl.plugin, "internal", sizeof (vl.plugin)); + sstrncpy (vl.plugin, "collectd", sizeof (vl.plugin)); vl.type_instance[0] = 0; vl.values_len = 1; @@ -1517,7 +1517,7 @@ void plugin_init_all (void) /* Init the value cache */ uc_init (); - if (IS_TRUE (global_option_get ("InternalStatistics"))) + if (IS_TRUE (global_option_get ("CollectInternalStats"))) record_statistics = 1; chain_name = global_option_get ("PreCacheChain"); @@ -2135,9 +2135,11 @@ int plugin_dispatch_values (value_list_t const *vl) static pthread_mutex_t statistics_lock = PTHREAD_MUTEX_INITIALIZER; if (check_drop_value ()) { - pthread_mutex_lock(&statistics_lock); - stats_values_dropped++; - pthread_mutex_unlock(&statistics_lock); + if(record_statistics) { + pthread_mutex_lock(&statistics_lock); + stats_values_dropped++; + pthread_mutex_unlock(&statistics_lock); + } return (0); }