Title: [opsview-base] [309] Merge patch from Nagios Core for better error message when plugin times out
Revision
309
Author
tvoon
Date
2013-07-11 09:15:49 +0100 (Thu, 11 Jul 2013)

Log Message

Merge patch from Nagios Core for better error message when plugin times out

Modified Paths

Added Paths

Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2013-07-11 08:10:14 UTC (rev 308)
+++ trunk/Makefile	2013-07-11 08:15:49 UTC (rev 309)
@@ -647,6 +647,7 @@
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_max_concurrent_decrements.patch
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_passive_host_svc_checks_and_host_svc_event_handlers.patch
 	cd ${NAGIOS} && patch -p1 < ../patches/nagios_fix_notifications_in_retention.patch
+	cd ${NAGIOS} && patch -p1 < ../patches/nagios_bugfix_10fe3be.patch
 	if [ $(KERNEL_NAME) = Linux ] ; then \
 		cd ${NAGIOS} && CFLAGS="${CFLAGS}" ./configure --with-nagios-user=$(NAGIOS_USER) --with-nagios-group=$(NAGIOS_GROUP) --with-command-group=$(NAGIOS_GROUP) --with-cgiurl=/cgi-bin --with-htmurl=/ --enable-libtap ; \
 	elif [ $(KERNEL_NAME) = Darwin ] ; then \

Added: trunk/patches/nagios_bugfix_10fe3be.patch
===================================================================
--- trunk/patches/nagios_bugfix_10fe3be.patch	                        (rev 0)
+++ trunk/patches/nagios_bugfix_10fe3be.patch	2013-07-11 08:15:49 UTC (rev 309)
@@ -0,0 +1,56 @@
+From 10fe3be2296282dd7b7c811be3884e36362c2a36 Mon Sep 17 00:00:00 2001
+From: Andreas Ericsson <a...@op5.se>
+Date: Tue, 11 Jun 2013 18:10:27 +0200
+Subject: [PATCH] core: Make it obvious when checks time out
+
+When checks time out and we just say "Check did not exit properly",
+people think things are severely broken, even though it's sort of
+true that the check really *didn't* exit properly when we killed it.
+
+We can be nicer though, and with this patch we are just that.
+
+Signed-off-by: Andreas Ericsson <a...@op5.se>
+---
+ base/checks.c | 16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/base/checks.c b/base/checks.c
+index b77938b..3a2c788 100644
+--- a/base/checks.c
++++ b/base/checks.c
+@@ -416,8 +416,12 @@ int handle_async_service_check_result(service *temp_service, check_result *queue
+ 	my_free(temp_service->long_plugin_output);
+ 	my_free(temp_service->perf_data);
+ 
++	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);
++		}
+ 	/* if there was some error running the command, just skip it (this shouldn't be happening) */
+-	if(queued_check_result->exited_ok == FALSE) {
++	else if(queued_check_result->exited_ok == FALSE) {
+ 
+ 		logit(NSLOG_RUNTIME_WARNING, TRUE, "Warning:  Check of service '%s' on host '%s' did not exit properly!\n", temp_service->description, temp_service->host_name);
+ 
+@@ -2575,9 +2579,17 @@ int handle_async_host_check_result(host *temp_host, check_result *queued_check_r
+ 
+ 	/* adjust return code (active checks only) */
+ 	if(queued_check_result->check_type == CHECK_TYPE_ACTIVE) {
++		if(queued_check_result->early_timeout) {
++			logit(NSLOG_RUNTIME_WARNING, TRUE, "Warning: Check of host '%s' timed out after %.2lf seconds\n", temp_host->name, temp_host->execution_time);
++			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);
++			result = STATE_UNKNOWN;
++			}
+ 
+ 		/* if there was some error running the command, just skip it (this shouldn't be happening) */
+-		if(queued_check_result->exited_ok == FALSE) {
++		else if(queued_check_result->exited_ok == FALSE) {
+ 
+ 			logit(NSLOG_RUNTIME_WARNING, TRUE, "Warning:  Check of host '%s' did not exit properly!\n", temp_host->name);
+ 
+-- 
+1.7.11.1
+

_______________________________________________
Opsview-checkins mailing list
Opsview-checkins@lists.opsview.org
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to