X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fthreshold.c;h=45ee3b4d02c61b722419577ee607580dcdb4cb26;hb=3d7453f6c3a13dc49e9ed6dd6d7a19202a3b087e;hp=8dcb711d5e6004bb82d266b8d9e950242681c50d;hpb=79593ed5e0a3def8e91be5b1de15a536af2d4a92;p=collectd.git diff --git a/src/threshold.c b/src/threshold.c index 8dcb711d..45ee3b4d 100644 --- a/src/threshold.c +++ b/src/threshold.c @@ -868,10 +868,11 @@ static int ut_missing (const value_list_t *vl, return (0); } /* }}} int ut_missing */ -int ut_config (oconfig_item_t *ci) +static int ut_config (oconfig_item_t *ci) { /* {{{ */ int i; int status = 0; + int old_size = c_avl_size (threshold_tree); threshold_t th; @@ -915,7 +916,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,