add --warn-count and --crit-count options to suppress alarm noise

Alarm criteria based solely on percentage was found to be difficult to be
tricky to setup in environments that has small ranges and big shared-nets
mixed up together.  These two new options should help making alarming more
useful.

Requested-by: Frank Bulk <fbulk@mypremieronline.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2015-11-28 00:33:12 +00:00
parent 7f3d553c7f
commit 5cede1ff31
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
4 changed files with 42 additions and 5 deletions

View file

@ -1005,9 +1005,9 @@ int output_alarming(void)
}
if (config.minsize < range_size) {
perc = (float)(100 * range_p->count) / range_size;
if (config.critical < perc)
if (config.critical < perc && (range_size - range_p->count) < config.crit_count)
rc++;
else if (config.warning < perc)
else if (config.warning < perc && (range_size - range_p->count) < config.warn_count)
rw++;
else
ro++;
@ -1025,9 +1025,9 @@ int output_alarming(void)
perc =
shared_p->available ==
0 ? 100 : (float)(100 * shared_p->used) / shared_p->available;
if (config.critical < perc)
if (config.critical < perc && shared_p->available < config.crit_count)
sc++;
else if (config.warning < perc)
else if (config.warning < perc && shared_p->available < config.warn_count)
sw++;
else
so++;