2.0b1 patch to make unreachables fully work, and some commentary
Joe Pruett
joey at clean.q7.com
Tue Jan 4 05:28:51 CET 2005
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"))
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
More information about the Developers
mailing list