renamed the option to CollectInternalStats; renamed 'internal' to 'collectd'; no...
authorYves Mettier <ymettier@free.fr>
Tue, 26 Aug 2014 11:02:49 +0000 (13:02 +0200)
committerYves Mettier <ymettier@free.fr>
Tue, 26 Aug 2014 11:02:49 +0000 (13:02 +0200)
src/collectd.conf.in
src/collectd.conf.pod
src/configfile.c
src/plugin.c

index f4a3112..1c051a0 100644 (file)
@@ -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 #
index ba9b6ca..f379cca 100644 (file)
@@ -222,7 +222,7 @@ on the I<Interval> information contained in each value list. This is used in
 the I<Threshold> configuration to dispatch notifications about missing values,
 see L<collectd-threshold(5)> for details.
 
-=item B<InternalStatistics> I<true|false>
+=item B<CollectInternalStats> I<true|false>
 
 Some internal statistics can be recorded to monitor Collectd itself.
 Default value : false.
index c099970..2eaaad1 100644 (file)
@@ -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"}
 };
index 0b91561..ce2fb55 100644 (file)
@@ -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);
        }