mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
output: use symbolic exit values for nagios commands
And ensure the exit values are set no matter how user will limit output. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
5454ab7086
commit
eb55946595
2 changed files with 15 additions and 3 deletions
|
|
@ -191,6 +191,13 @@ enum limbits {
|
||||||
BIT3 = 0x4
|
BIT3 = 0x4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*! \def STATE_OK
|
||||||
|
* \brief Nagios alarm exit value.
|
||||||
|
*/
|
||||||
|
#define STATE_OK 0
|
||||||
|
#define STATE_WARNING 1
|
||||||
|
#define STATE_CRITICAL 2
|
||||||
|
|
||||||
/* Global variables */
|
/* Global variables */
|
||||||
/* \var prefix_length Length of each prefix. */
|
/* \var prefix_length Length of each prefix. */
|
||||||
int prefix_length[2][NUM_OF_PREFIX];
|
int prefix_length[2][NUM_OF_PREFIX];
|
||||||
|
|
|
||||||
11
src/output.c
11
src/output.c
|
|
@ -1070,16 +1070,21 @@ int output_alarming(void)
|
||||||
shared_p++;
|
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)) {
|
if ((0 < rc && config.output_limit[1] & BIT1) || (0 < sc && config.output_limit[1] & BIT2)) {
|
||||||
ret_val = 2;
|
|
||||||
fprintf(outfile, "CRITICAL: %s:",
|
fprintf(outfile, "CRITICAL: %s:",
|
||||||
program_name);
|
program_name);
|
||||||
} else if ((0 < rw && config.output_limit[1] & BIT1) || (0 < sw && config.output_limit[1] & BIT2)) {
|
} else if ((0 < rw && config.output_limit[1] & BIT1) || (0 < sw && config.output_limit[1] & BIT2)) {
|
||||||
ret_val = 1;
|
|
||||||
fprintf(outfile, "WARNING: %s:",
|
fprintf(outfile, "WARNING: %s:",
|
||||||
program_name);
|
program_name);
|
||||||
} else {
|
} else {
|
||||||
ret_val = 0;
|
|
||||||
if (config.output_limit[1] & BIT3)
|
if (config.output_limit[1] & BIT3)
|
||||||
fprintf(outfile, "OK:");
|
fprintf(outfile, "OK:");
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue