summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 35e61a3)
raw | patch | inline | side by side (parent: 35e61a3)
author | Aaron Brady <bradya@gmail.com> | |
Wed, 2 Mar 2011 23:10:26 +0000 (23:10 +0000) | ||
committer | Aaron Brady <bradya@gmail.com> | |
Sun, 15 Jan 2012 13:21:41 +0000 (13:21 +0000) |
src/collectd-threshold.pod | patch | blob | history | |
src/threshold.c | patch | blob | history |
index 5d1a645c95cbc81931475bb3544483e04ef1f780..02e41b8b83e90cc34d60faa263f558f7a54dbc89 100644 (file)
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.
+=item B<PersistOK> B<true>|B<false>
+
+Sets how OKAY notifications act. If set to B<true> one notification will be
+generated for each value that is in the acceptable range. If set to B<false>
+(the default) then a notification is only generated if a value is in range but
+the previous value was not.
+
=item B<Percentage> B<true>|B<false>
If set to B<true>, the minimum and maximum values given are interpreted as
diff --git a/src/threshold.c b/src/threshold.c
index 342d08acae919edd72cbea74b10a6e798dc4a094..d4cfd6ea922ef2dbc984e6ca137f28774aa6ed68 100644 (file)
--- a/src/threshold.c
+++ b/src/threshold.c
#define UT_FLAG_PERSIST 0x02
#define UT_FLAG_PERCENTAGE 0x04
#define UT_FLAG_INTERESTING 0x08
+#define UT_FLAG_PERSIST_OK 0x10
typedef struct threshold_s
{
char host[DATA_MAX_NAME_LEN];
status = cf_util_get_flag (option, &th.flags, UT_FLAG_INVERT);
else if (strcasecmp ("Persist", option->key) == 0)
status = cf_util_get_flag (option, &th.flags, UT_FLAG_PERSIST);
+ else if (strcasecmp ("PersistOK", option->key) == 0)
+ status = cf_util_get_flag (option, &th.flags, UT_FLAG_PERSIST_OK);
else if (strcasecmp ("Percentage", option->key) == 0)
status = cf_util_get_flag (option, &th.flags, UT_FLAG_PERCENTAGE);
else if (strcasecmp ("Hits", option->key) == 0)
if ( (th->hits != 0) )
{
int hits = uc_get_hits(ds,vl);
- /* The STATE_OKAY always reset hits, or if hits reaise the limit */
- if ( (state == STATE_OKAY) || (hits > th->hits) )
+ /* STATE_OKAY resets hits unless PERSIST_OK flag is set. Hits resets if
+ * threshold is hit. */
+ if ( ( (state == STATE_OKAY) && ((th->flags & UT_FLAG_PERSIST_OK) == 0) ) || (hits > th->hits) )
{
DEBUG("ut_report_state: reset uc_get_hits = 0");
uc_set_hits(ds,vl,0); /* reset hit counter and notify */
state_old = uc_get_state (ds, vl);
- /* If the state didn't change, only report if `persistent' is specified and
- * the state is not `okay'. */
+ /* If the state didn't change, report if `persistent' is specified. If the
+ * state is `okay', then only report if `persist_ok` flag is set. */
if (state == state_old)
{
if ((th->flags & UT_FLAG_PERSIST) == 0)
return (0);
- else if (state == STATE_OKAY)
+ else if ( (state == STATE_OKAY) && ((th->flags & UT_FLAG_PERSIST_OK) == 0) )
return (0);
}