From 74fa9577b1acbb965488aa0a48c140d8ece437bf Mon Sep 17 00:00:00 2001 From: Michael Salmon Date: Thu, 16 Jul 2015 09:05:54 +0200 Subject: [PATCH] threshold plugin: Register callbacks only once. Fixes: #551 Signed-off-by: Florian Forster --- src/threshold.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/threshold.c b/src/threshold.c index 391ee932..a70ec8af 100644 --- a/src/threshold.c +++ b/src/threshold.c @@ -962,6 +962,7 @@ int ut_config (oconfig_item_t *ci) { /* {{{ */ int i; int status = 0; + int old_size = c_avl_size (threshold_tree); threshold_t th; @@ -1005,7 +1006,9 @@ int ut_config (oconfig_item_t *ci) break; } - if (c_avl_size (threshold_tree) > 0) { + /* register callbacks if this is the first time we see a valid config */ + if ((old_size == 0) && (c_avl_size (threshold_tree) > 0)) + { plugin_register_missing ("threshold", ut_missing, /* user data = */ NULL); plugin_register_write ("threshold", ut_check_threshold, -- 2.11.0