[Nagios-devel] 2.0b1 patch to make unreachables fully work, and some commentary

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] 2.0b1 patch to make unreachables fully work, and some commentary

Post by Guest »

i just started installing a 2.0b1 installation and couldn't figure out why
i would get unreachable email messages, but nothing would show in the web
interface. i finally found the bug (patch below). but along the way
while trying to figure out what was going on i got very confused by the
different uses of state inside the code. there are #defines for HOST_UP,
_DOWN, _UNREACHABLE, etc with values like 1, 2, 4. but the status file
uses 0, 1, 2. similar issues seem to apply to services. and nowhere was
an obvious conversion between the two. is this some historical artifact?

anyway, after poking around i finally found that the problem was in the
xsddefault.c file that was converting the current_state into a boolean,
rather than just leaving it as is. my fix seems to have the correct
functionality.

--- xdata/xsddefault.c.orig 2005-01-03 20:14:18.000000000 -0800
+++ xdata/xsddefault.c 2005-01-03 20:15:12.000000000 -0800
@@ -638,7 +638,7 @@
else if(!strcmp(var,"check_latency"))
temp_hoststatus->latency=strtod(val,NULL);
else if(!strcmp(var,"current_state"))
- temp_hoststatus->status=(atoi(val)>0)?TRUE:FALSE;
+ temp_hoststatus->status=atoi(val)>0;
else if(!strcmp(var,"last_hard_state"))
temp_hoststatus->last_hard_state=atoi(val);
else if(!strcmp(var,"plugin_output"))






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked