[icinga-checkins] icinga.org: icinga-core/master: print proper messages for known error return codes

git at icinga.org git at icinga.org
Sat Jul 24 12:44:27 CEST 2010


Module: icinga-core
Branch: master
Commit: a5663c99e63875f3d5f4c402539e99744fb1c567
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=a5663c99e63875f3d5f4c402539e99744fb1c567

Author: Christoph Maser <cmr at financial.com>
Date:   Sat Jul 24 12:31:37 2010 +0200

print proper messages for known error return codes

fixes #509

---

 base/checks.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/base/checks.c b/base/checks.c
index 2c1617f..b5faedb 100644
--- a/base/checks.c
+++ b/base/checks.c
@@ -1145,9 +1145,14 @@ int handle_async_service_check_result(service *temp_service, check_result *queue
 	/* make sure the return code is within bounds */
 	else if(queued_check_result->return_code<0 || queued_check_result->return_code>3){
 
-		logit(NSLOG_RUNTIME_WARNING,TRUE,"Warning: Return code of %d for check of service '%s' on host '%s' was out of bounds.%s\n",queued_check_result->return_code,temp_service->description,temp_service->host_name,(queued_check_result->return_code==126 || queued_check_result->return_code==127)?" Make sure the plugin you're trying to run actually exists.":"");
-
-		asprintf(&temp_service->plugin_output,"(Return code of %d is out of bounds%s)",queued_check_result->return_code,(queued_check_result->return_code==126 || queued_check_result->return_code==127)?" - plugin may be missing":"");
+		if ( queued_check_result->return_code==126 ) {
+			asprintf(&temp_service->plugin_output,"The command defined for service %s is not an executable\n", queued_check_result->service_description);
+		} else if  ( queued_check_result->return_code==127 ) {
+			asprintf(&temp_service->plugin_output,"The command defined for service %s does not exist\n", queued_check_result->service_description);
+		} else {
+			asprintf(&temp_service->plugin_output, "Return code of %d is out of bounds", queued_check_result->return_code);
+		}
+		logit(NSLOG_RUNTIME_WARNING,TRUE,"%s",temp_service->plugin_output);
 
 		temp_service->current_state=STATE_CRITICAL;
 	}





More information about the icinga-checkins mailing list