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

git at icinga.org git at icinga.org
Sat Jul 24 12:32:42 CEST 2010


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

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

print proper messages for known error return codes

---

 base/checks.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/base/checks.c b/base/checks.c
index 93b9018..0a2a322 100644
--- a/base/checks.c
+++ b/base/checks.c
@@ -1110,11 +1110,16 @@ 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;
+		temp_service->current_state=STATE_CRITICAL; 
 	}
 
 	/* else the return code is okay... */





More information about the icinga-checkins mailing list