X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fthreshold.c;h=45ee3b4d02c61b722419577ee607580dcdb4cb26;hb=1fc00932fd49fa535551cc4bba09c4e4be059ab4;hp=8dcb711d5e6004bb82d266b8d9e950242681c50d;hpb=8c864f5e634118fce2446ebbba96a1cb7ec39dda;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,