add --warn-count and --crit-count test, and fix related bug

I should consider writing tests before features.  Sadly recently added new
options did not even work.  Oh well, at least I did not release them before
noticing this.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2015-12-05 19:23:28 +00:00
parent 15802d6648
commit da4b7a783a
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
4 changed files with 57 additions and 2 deletions

View file

@ -974,9 +974,9 @@ int output_alarming(void)
perc =
shared_p->available ==
0 ? 100 : (float)(100 * shared_p->used) / shared_p->available;
if (config.critical < perc && shared_p->available < config.crit_count)
if (config.critical < perc && shared_p->used < config.crit_count)
sc++;
else if (config.warning < perc && shared_p->available < config.warn_count)
else if (config.warning < perc && shared_p->used < config.warn_count)
sw++;
else
so++;