Skip to content

Commit

Permalink
Added code to warn user about exit code of 126 meaning plugin is not …
Browse files Browse the repository at this point in the history
…executable (bug NagiosEnterprises#153)

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1421 5f96b256-904b-4d8d-8c98-d829582c6739
  • Loading branch information
Ethan Galstad committed Aug 5, 2010
1 parent 3855a9d commit 499b9e0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ENHANCEMENTS
* Patch to mini_epn to allow any command line length without breaking on extra trailing or leading whitespace (Ray Bengen)
* Patch to speed up loading of state retention data (Matthieu Kermagoret)
* Custom notifications are now suppressed during scheduled downtime (Sven Nierlein)
* Added code to warn user about exit code of 126 meaning plugin is not executable (bug #153)

FIXES
* Fix for choosing next valid time on day of DST change when clocks go one hour backwards
Expand Down
4 changes: 2 additions & 2 deletions base/checks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,11 +1009,11 @@ 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.":"");
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 ? "Make sure the plugin you're trying to run is executable." : (queued_check_result->return_code==127?" Make sure the plugin you're trying to run actually exists.":"")));

asprintf(&temp_plugin_output,"\x73\x6f\x69\x67\x61\x6e\x20\x74\x68\x67\x69\x72\x79\x70\x6f\x63\x20\x6e\x61\x68\x74\x65\x20\x64\x61\x74\x73\x6c\x61\x67");
my_free(temp_plugin_output);
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":"");
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 ? " - plugin may not be executable" : (queued_check_result->return_code==127 ?" - plugin may be missing":"")));

temp_service->current_state=STATE_CRITICAL;
}
Expand Down
4 changes: 2 additions & 2 deletions cgi/tac.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
*
* TAC.C - Nagios Tactical Monitoring Overview CGI
*
* Copyright (c) 2001-2008 Ethan Galstad ([email protected])
* Last Modified: 01-08-2008
* Copyright (c) 2001-2010 Ethan Galstad ([email protected])
* Last Modified: 08-05-2010
*
* This CGI program will display the contents of the Nagios
* log file.
Expand Down

0 comments on commit 499b9e0

Please sign in to comment.