Code

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 f4a31129eb32ea26dac2fbbc77f9d59f9ab3f818..1c051a0690453ed5988512d6c7f429414bfb14d5 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 ba9b6cae89007fc5bf29635db658d51b86f7f3bd..f379ccae7f90ab974c826adfa36019272c757bc5 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 c099970940eee115f8bfca0c3594127060491fc7..2eaaad1af4bbcae01e795cfbb478b3838c50b579 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 0b9156134df9c0c93ea06357460e71b60030c55d..ce2fb553c977219f5c71db5c41c782cabcedcf2f 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);
        }