diff --git a/src/dhcpd-pools.h b/src/dhcpd-pools.h index b27b85b..90582b5 100644 --- a/src/dhcpd-pools.h +++ b/src/dhcpd-pools.h @@ -191,6 +191,13 @@ enum limbits { BIT3 = 0x4 }; +/*! \def STATE_OK + * \brief Nagios alarm exit value. + */ +#define STATE_OK 0 +#define STATE_WARNING 1 +#define STATE_CRITICAL 2 + /* Global variables */ /* \var prefix_length Length of each prefix. */ int prefix_length[2][NUM_OF_PREFIX]; diff --git a/src/output.c b/src/output.c index 112819d..6720e13 100644 --- a/src/output.c +++ b/src/output.c @@ -1070,16 +1070,21 @@ int output_alarming(void) shared_p++; } } + + if (sc || rc) + ret_val = STATE_CRITICAL; + else if (sw || rw) + ret_val = STATE_WARNING; + else + ret_val = STATE_OK; + 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 && config.output_limit[1] & BIT1) || (0 < sw && config.output_limit[1] & BIT2)) { - ret_val = 1; fprintf(outfile, "WARNING: %s:", program_name); } else { - ret_val = 0; if (config.output_limit[1] & BIT3) fprintf(outfile, "OK:"); else