X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fthreshold.c;h=ed8312992b437c9984d6885309bc972f1450fb4d;hb=6a1a62048b6d0d2ddf5c17295609d3ebf010f40b;hp=38c7efb016d73a1d62bd10bb3efb0e5670caf1e1;hpb=88f22ff8b4c69eb38b6aaab30df212df1871d4ec;p=collectd.git diff --git a/src/threshold.c b/src/threshold.c index 38c7efb0..ed831299 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,