output: make output limits to apply to alarm return values

The earlier behavior made alarming nearly impossible to use for shared
networks only, as they often are expected to be whole lot less full than
ranges.  Unfortunately if a alarm level was exceeded either by range or
shared network the exit value changed.  In most of the cases that lead
alarms to be sent, without sensible message.

Reported-by: Dan Pritts <danno@umich.edu>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2013-07-10 22:34:47 +01:00
parent 7de719a80c
commit 08c9bcc502

View file

@ -1061,11 +1061,11 @@ int output_alarming(void)
shared_p++; shared_p++;
} }
} }
if (0 < rc || 0 < sc) { if ((0 < rc && config.output_limit[1] & BIT1) || (0 < sc && config.output_limit[1] & BIT2)) {
ret_val = 2; ret_val = 2;
fprintf(outfile, "CRITICAL: %s: ", fprintf(outfile, "CRITICAL: %s: ",
program_name); program_name);
} else if (0 < rw || 0 < sw) { } else if ((0 < rw && config.output_limit[1] & BIT1) || (0 < sw && config.output_limit[1] & BIT2)) {
ret_val = 1; ret_val = 1;
fprintf(outfile, "WARNING: %s: ", fprintf(outfile, "WARNING: %s: ",
program_name); program_name);