Explorar el Código

check_nrpe info logging

Fix for issue https://github.com/NagiosEnterprises/nrpe/issues/64
John C. Frickson hace 9 años
padre
commit
fe006d2556
Se han modificado 2 ficheros con 10 adiciones y 3 borrados
  1. 1 0
      Changelog
  2. 9 3
      src/check_nrpe.c

+ 1 - 0
Changelog

@@ -18,6 +18,7 @@ FIXES
 - Fixes to README.SSL.md and SECURITY.md (Elan Ruusamäe)
 - Changed the 'check_load' command in nrpe.cfg.in (minusdavid)
 - Cleanup of config.h.in suggested by Ruben Kerkhof
+- Minor change to logging in check_nrpe (John Frickson)
 
 
 3.0 - 2016-08-01

+ 9 - 3
src/check_nrpe.c

@@ -46,6 +46,7 @@ int show_help = FALSE;
 int show_license = FALSE;
 int show_version = FALSE;
 int packet_ver = NRPE_PACKET_VERSION_3;
+int force_v2_packet = 0;
 int payload_size = 0;
 
 #ifdef HAVE_SSL
@@ -149,7 +150,7 @@ int main(int argc, char **argv)
 
 	if (result == -1) {
 		/* Failure reading from remote, so try version 2 packet */
-		syslog(LOG_NOTICE, "Remote %s does not support Version 3 Packets", rem_host);
+		syslog(LOG_INFO, "Remote %s does not support Version 3 Packets", rem_host);
 		packet_ver = NRPE_PACKET_VERSION_2;
 
 		/* Rerun the setup */
@@ -168,8 +169,12 @@ int main(int argc, char **argv)
 		result = read_response();	/* Get the response */
 	}
 
-	if (result != -1)
-		syslog(LOG_NOTICE, "Remote %s accepted a Version %d Packet", rem_host, packet_ver);
+	if (result != -1) {
+		if (force_v2_packet = 0 && packet_ver == NRPE_PACKET_VERSION_2)
+			syslog(LOG_INFO, "Remote %s accepted a Version %d Packet", rem_host, packet_ver);
+		else
+			syslog(LOG_DEBUG, "Remote %s accepted a Version %d Packet", rem_host, packet_ver);
+	}
 
 	return result;
 }
@@ -336,6 +341,7 @@ int process_arguments(int argc, char **argv, int from_config_file)
 				break;
 			}
 			packet_ver = NRPE_PACKET_VERSION_2;
+			force_v2_packet = 1;
 			break;
 
 		case '4':