summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: acbd253)
raw | patch | inline | side by side (parent: acbd253)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Wed, 19 Dec 2007 14:07:10 +0000 (15:07 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Wed, 19 Dec 2007 14:07:10 +0000 (15:07 +0100) |
The idea is that, if the option is set to `true', many notifications will be
sent, until the problem vanishes again. If set to `false' only one notification
will be sent upon a state change.
This, however, is not implemented yet.
sent, until the problem vanishes again. If set to `false' only one notification
will be sent upon a state change.
This, however, is not implemented yet.
src/collectd.conf.pod | patch | blob | history | |
src/utils_threshold.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 44338c6f27df7c9dc4c69bee2640c7d1565786a1..447870d7069b0792548cd97f2f84cc1042d8e261 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
values between B<Min> and B<Max> are not okay. Defaults, of course, to
B<false>.
+=item B<Persist> B<true>|B<false>
+
+Sets how often notifications are generated. If set to B<true> one notification
+will be generated for each value that is out of the acceptable range. If set to
+B<false> (the default) then a notification is only generated if a value is out
+of range but the previous value was okay.
+
+This applies to missing values, too: If set to B<true> a notification about a
+missing value is generated once every B<Interval> seconds. If set to B<false>
+only one such notification is generated until the value appears again.
+
=back
=head1 SEE ALSO
diff --git a/src/utils_threshold.c b/src/utils_threshold.c
index d7792f7c6176f3b415be52ef718173031102b85a..4c4393515e97ffba14072644f288a81e2315622b 100644 (file)
--- a/src/utils_threshold.c
+++ b/src/utils_threshold.c
return (0);
} /* int ut_config_type_invert */
+static int ut_config_type_persist (threshold_t *th, oconfig_item_t *ci)
+{
+ if ((ci->values_num != 1)
+ || (ci->values[0].type != OCONFIG_TYPE_BOOLEAN))
+ {
+ WARNING ("threshold values: The `Persist' option needs exactly one "
+ "boolean argument.");
+ return (-1);
+ }
+
+ if (ci->values[0].value.boolean)
+ th->flags |= UT_FLAG_PERSIST;
+ else
+ th->flags &= ~UT_FLAG_PERSIST;
+
+ return (0);
+} /* int ut_config_type_persist */
+
static int ut_config_type (const threshold_t *th_orig, oconfig_item_t *ci)
{
int i;
status = ut_config_type_min (&th, option);
else if (strcasecmp ("Invert", option->key) == 0)
status = ut_config_type_invert (&th, option);
+ else if (strcasecmp ("Persist", option->key) == 0)
+ status = ut_config_type_persist (&th, option);
else
{
WARNING ("threshold values: Option `%s' not allowed inside a `Type' "
host = plugin = plugin_instance = type = type_instance = NULL;
th = threshold_search (&ds, &vl);
- if (th != NULL)
- return (1);
- else
+ if (th == NULL)
return (0);
+ if ((th->flags & UT_FLAG_PERSIST) == 0)
+ return (1);
+ return (2);
} /* int ut_check_interesting */
/* vim: set sw=2 ts=8 sts=2 tw=78 fdm=marker : */