Răsfoiți Sursa

NRPE returns OK if check can't be executed

Fix for issue https://github.com/NagiosEnterprises/nrpe/issues/19
using diff from Pull Request https://github.com/NagiosEnterprises/nrpe/pull/14
John C. Frickson 10 ani în urmă
părinte
comite
314749e366
2 a modificat fișierele cu 6 adăugiri și 2 ștergeri
  1. 1 0
      Changelog
  2. 5 2
      src/nrpe.c

+ 1 - 0
Changelog

@@ -22,6 +22,7 @@ FIXES
 - Connection Timeout and Connection Refused messages need a new line (Andrew Widdersheim)
 - allowed_hosts doesn't work, if one of the hostnames can't be resolved by dns (John Frickson)
 - allowed_hosts doesn't work with a hostname resolving to an IPv6 address (John Frickson)
+- Return UNKNOWN when issues occur (Andrew Widdersheim)
 
 2.15 - 09/06/2013
 -----------------

+ 5 - 2
src/nrpe.c

@@ -1688,10 +1688,13 @@ void handle_connection(int sock){
 				syslog(LOG_DEBUG, "Command completed with return code %d and output: %s", result, send_buff);
 
 			/* see if the command timed out */
-			if (early_timeout == TRUE)
+			if (early_timeout == TRUE) {
 				sprintf(send_buff, "NRPE: Command timed out after %d seconds\n", command_timeout);
-			else if(!strcmp(send_buff,""))
+				result=STATE_UNKNOWN;
+			} else if(!strcmp(send_buff,"")) {
 				sprintf(send_buff, "NRPE: Unable to read output\n");
+				result=STATE_UNKNOWN;
+			}
 
 			/* check return code bounds */
 			if ((result < 0) || (result > 3)) {