[PATCH] checks: Set check state to UNKNOWN when there's a timeout

Robin Sonefors robin.sonefors at op5.com
Mon Aug 19 14:59:15 CEST 2013


When a check - host or service - fails to exit properly, it always
becomes CRITICAL. When an active host check times out, it goes into
UNKNOWN. When a service check times out, nothing is done to the state,
which led to my system telling me that a check that timed out was an OK
check.

This thus sets the state to UNKNOWN when the check didn't exit in time,
because that seems to make more sense and is analogous with what's done
for host checks.

Still, the whole CRITICAL vs UNKNOWN descibed above makes me a bit less
confident in my fix than I'd like - does this need more work?

Signed-off-by: Robin Sonefors <robin.sonefors at op5.com>
---
 base/checks.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/base/checks.c b/base/checks.c
index 76a9b7d..c601b9f 100644
--- a/base/checks.c
+++ b/base/checks.c
@@ -416,6 +416,7 @@ int handle_async_service_check_result(service *temp_service, check_result *queue
 	if(queued_check_result->early_timeout == TRUE) {
 		logit(NSLOG_RUNTIME_WARNING, TRUE, "Warning: Check of service '%s' on host '%s' timed out after %.3fs!\n", temp_service->description, temp_service->host_name, temp_service->execution_time);
 		asprintf(&temp_service->plugin_output, "(Service check timed out after %.2lf seconds)\n", temp_service->execution_time);
+		temp_service->current_state = STATE_UNKNOWN;
 		}
 	/* if there was some error running the command, just skip it (this shouldn't be happening) */
 	else if(queued_check_result->exited_ok == FALSE) {
-- 
1.8.3.1


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk




More information about the Developers mailing list