[PATCH 2/2] checks: When a check times out, include the incomplete check output

Robin Sonefors robin.sonefors at op5.com
Fri Sep 13 13:07:29 CEST 2013


When debugging why a check timed out, this might give you additional
clues.

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

diff --git a/base/checks.c b/base/checks.c
index 04cd3ec..356098f 100644
--- a/base/checks.c
+++ b/base/checks.c
@@ -417,7 +417,10 @@ 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);
+		asprintf(&temp_service->plugin_output,
+			"(Service check timed out after %.2lf seconds, got output: %s)\n",
+			temp_service->execution_time,
+			queued_check_result->output ? queued_check_result->output : "(NULL)");
 		temp_service->current_state = service_check_timeout_state;
 		}
 	/* if there was some error running the command, just skip it (this shouldn't be happening) */
@@ -2237,7 +2240,10 @@ int handle_async_host_check_result(host *temp_host, check_result *queued_check_r
 			my_free(temp_host->plugin_output);
 			my_free(temp_host->long_plugin_output);
 			my_free(temp_host->perf_data);
-			asprintf(&temp_host->plugin_output, "(Host check timed out after %.2lf seconds)", temp_host->execution_time);
+			asprintf(&temp_host->plugin_output,
+				"(Host check timed out after %.2lf seconds, got output: %s)",
+				temp_host->execution_time,
+				queued_check_result->output ? queued_check_result->output : "(NULL)");
 			result = STATE_UNKNOWN;
 			}
 
-- 
1.8.3.1


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk




More information about the Developers mailing list