From 08c9bcc502a8a499b805fdc10c7198d6ab6fbf36 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Wed, 10 Jul 2013 22:34:47 +0100 Subject: [PATCH] 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 Signed-off-by: Sami Kerola --- src/output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/output.c b/src/output.c index cb80ba7..08cdfdf 100644 --- a/src/output.c +++ b/src/output.c @@ -1061,11 +1061,11 @@ int output_alarming(void) 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; fprintf(outfile, "CRITICAL: %s: ", 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; fprintf(outfile, "WARNING: %s: ", program_name);