X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_threshold.c;h=68b85a37468bb639e5ea0c5f96c1615b162b7984;hb=068ae14b916aa298995433da83302032c5e57c76;hp=91959b9d4387f2389bbac1e8c8e01e95ee5701ae;hpb=bab707fe46b2ef69f391864f3bb08b4dca19634e;p=collectd.git diff --git a/src/utils_threshold.c b/src/utils_threshold.c index 91959b9d..68b85a37 100644 --- a/src/utils_threshold.c +++ b/src/utils_threshold.c @@ -297,7 +297,7 @@ static int ut_config_type (const threshold_t *th_orig, oconfig_item_t *ci) if (strcasecmp ("Instance", option->key) == 0) status = ut_config_type_instance (&th, option); - if (strcasecmp ("DataSource", option->key) == 0) + else if (strcasecmp ("DataSource", option->key) == 0) status = ut_config_type_datasource (&th, option); else if ((strcasecmp ("WarningMax", option->key) == 0) || (strcasecmp ("FailureMax", option->key) == 0)) @@ -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) { @@ -639,7 +647,7 @@ static int ut_report_state (const data_set_t *ds, "%f. That is within the %s region of %f and %f.", ds->ds[ds_index].name, values[ds_index], (state == STATE_ERROR) ? "failure" : "warning", - min, min); + min, max); } else { @@ -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 */ @@ -853,6 +862,7 @@ int ut_check_interesting (const char *name) if (status != 0) { ERROR ("ut_check_interesting: parse_identifier failed."); + sfree (name_copy); return (-1); }