X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_threshold.c;h=1b211385554b62ed8cec1bbc5f67aadbfb19a149;hb=b72d521340383b6418fa6a75faca3bc45f06b14a;hp=bf04c633d62a28b13d3868816c3b0f1083bb841d;hpb=430b0b4d0275f7fea64376fc166e81fc0bcc36bf;p=collectd.git diff --git a/src/utils_threshold.c b/src/utils_threshold.c index bf04c633..1b211385 100644 --- a/src/utils_threshold.c +++ b/src/utils_threshold.c @@ -616,6 +616,14 @@ static int ut_report_state (const data_set_t *ds, bufsize -= status; } + plugin_notification_meta_add_string (&n, "DataSource", + ds->ds[ds_index].name); + plugin_notification_meta_add_double (&n, "CurrentValue", values[ds_index]); + plugin_notification_meta_add_double (&n, "WarningMin", th->warning_min); + plugin_notification_meta_add_double (&n, "WarningMax", th->warning_max); + plugin_notification_meta_add_double (&n, "FailureMin", th->failure_min); + plugin_notification_meta_add_double (&n, "FailureMax", th->failure_max); + /* Send an okay notification */ if (state == STATE_OKAY) { @@ -666,6 +674,7 @@ static int ut_report_state (const data_set_t *ds, plugin_dispatch_notification (&n); + plugin_notification_meta_free (&n); return (0); } /* }}} int ut_report_state */ @@ -680,7 +689,7 @@ static int ut_report_state (const data_set_t *ds, * Does not fail. */ static int ut_check_one_data_source (const data_set_t *ds, - const value_list_t *vl, + const value_list_t __attribute__((unused)) *vl, const threshold_t *th, const gauge_t *values, int ds_index) @@ -824,8 +833,18 @@ int ut_check_threshold (const data_set_t *ds, const value_list_t *vl) return (0); } /* }}} int ut_check_threshold */ +/* + * int ut_check_interesting (PUBLIC) + * + * Given an identification returns + * 0: No threshold is defined. + * 1: A threshold has been found. The flag `persist' is off. + * 2: A threshold has been found. The flag `persist' is on. + * (That is, it is expected that many notifications are sent until the + * problem disappears.) + */ int ut_check_interesting (const char *name) -{ +{ /* {{{ */ char *name_copy = NULL; char *host = NULL; char *plugin = NULL; @@ -853,6 +872,7 @@ int ut_check_interesting (const char *name) if (status != 0) { ERROR ("ut_check_interesting: parse_identifier failed."); + sfree (name_copy); return (-1); } @@ -877,6 +897,6 @@ int ut_check_interesting (const char *name) if ((th->flags & UT_FLAG_PERSIST) == 0) return (1); return (2); -} /* int ut_check_interesting */ +} /* }}} int ut_check_interesting */ /* vim: set sw=2 ts=8 sts=2 tw=78 fdm=marker : */