output: fix warn and crit counts on shared networks

The crit/warn_count is tested against used rather than free.  It is only for
shared networks, the range correctly subtracts count from size to get its
free.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Mark Sangster 2019-04-15 15:15:58 +01:00 committed by Sami Kerola
parent 17d68b7e3e
commit 07b4eaa480
No known key found for this signature in database
GPG key ID: 0D46FEF7E61DBB46
4 changed files with 28 additions and 2 deletions

View file

@ -158,11 +158,11 @@ int shnet_output_helper(struct conf_t *state, struct output_helper_t *oh,
oh->status = STATUS_IGNORED;
if (state->skip_minsize)
return 1;
} else if (state->critical < oh->percent && shared_p->used < state->crit_count) {
} else if (state->critical < oh->percent && (shared_p->available - shared_p->used) < state->crit_count) {
oh->status = STATUS_CRIT;
if (state->skip_critical)
return 1;
} else if (state->warning < oh->percent && shared_p->used < state->warn_count) {
} else if (state->warning < oh->percent && (shared_p->available - shared_p->used) < state->warn_count) {
oh->status = STATUS_WARN;
if (state->skip_warning)
return 1;