summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: be6aa28)
raw | patch | inline | side by side (parent: be6aa28)
author | Florian Forster <octo@collectd.org> | |
Fri, 23 Dec 2016 08:39:08 +0000 (09:39 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 23 Dec 2016 08:39:11 +0000 (09:39 +0100) |
The previous special-snowflake-solution had issues since it didn't set a plugin
context up.
Fixes: #2108
context up.
Fixes: #2108
src/daemon/plugin.c | patch | blob | history |
diff --git a/src/daemon/plugin.c b/src/daemon/plugin.c
index f313f3680be60fe442f7596194cbf9b96769953f..2117662fa35627e5f5cdcdc2dc4e7f1ca4ecfce8 100644 (file)
--- a/src/daemon/plugin.c
+++ b/src/daemon/plugin.c
return (plugindir);
}
-static void plugin_update_internal_statistics(void) { /* {{{ */
-
+static int plugin_update_internal_statistics() { /* {{{ */
gauge_t copy_write_queue_length = (gauge_t)write_queue_length;
/* Initialize `vl' */
value_list_t vl = VALUE_LIST_INIT;
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, "collectd", sizeof(vl.plugin));
/* Write queue */
vl.type_instance[0] = 0;
plugin_dispatch_values(&vl);
- return;
-} /* }}} void plugin_update_internal_statistics */
+ return 0;
+} /* }}} int plugin_update_internal_statistics */
static void destroy_callback(callback_func_t *cf) /* {{{ */
{
/* Init the value cache */
uc_init();
- if (IS_TRUE(global_option_get("CollectInternalStats")))
+ if (IS_TRUE(global_option_get("CollectInternalStats"))) {
record_statistics = 1;
+ plugin_register_read("collectd", plugin_update_internal_statistics);
+ }
chain_name = global_option_get("PreCacheChain");
pre_cache_chain = fc_chain_get_by_name(chain_name);
/* TODO: Rename this function. */
void plugin_read_all(void) {
- if (record_statistics) {
- plugin_update_internal_statistics();
- }
uc_check_timeout();
return;