فهرست منبع

Add perfdata to check_ssh (#3244097 - Marco Beck)

Thomas Guyot-Sionnest 15 سال پیش
والد
کامیت
1bc7a4a198
3فایلهای تغییر یافته به همراه11 افزوده شده و 2 حذف شده
  1. 1 0
      NEWS
  2. 1 0
      THANKS.in
  3. 9 2
      plugins/check_ssh.c

+ 1 - 0
NEWS

@@ -6,6 +6,7 @@ This file documents the major additions and syntax changes between releases.
 	check_disk_smb now allows spaces in share names (#990948, #1370031, Debian #601699)
 	check_http now uses standard threshold functions (enables floating point and ranges)
 	check_http now checks for and prints the certificate cn (hostname) in SSL certificate checks (Stéphane Urbanovski)
+	Add perfdata to check_ssh (#3244097 - Marco Beck)
 
 	FIXES
 	Fix check_disk free space calculation if blocksizes differ within a disk group (Bekar - #2973603)

+ 1 - 0
THANKS.in

@@ -267,3 +267,4 @@ Craig Leres
 Brian Landers
 Ryan Kelly
 Stéphane Urbanovski
+Marco Beck

+ 9 - 2
plugins/check_ssh.c

@@ -215,6 +215,10 @@ ssh_connect (char *haddr, int hport, char *remote_version)
 	char *ssh_proto = NULL;
 	char *ssh_server = NULL;
 	static char *rev_no = VERSION;
+	struct timeval tv;
+	double elapsed_time;
+
+	gettimeofday(&tv, NULL);
 
 	result = my_tcp_connect (haddr, hport, &sd);
 
@@ -250,9 +254,12 @@ ssh_connect (char *haddr, int hport, char *remote_version)
 			exit (STATE_WARNING);
 		}
 
+		elapsed_time = (double)deltime(tv) / 1.0e6;
+
 		printf
-			(_("SSH OK - %s (protocol %s)\n"),
-			 ssh_server, ssh_proto);
+			(_("SSH OK - %s (protocol %s) | %s\n"),
+			 ssh_server, ssh_proto, fperfdata("time", elapsed_time, "s",
+			 FALSE, 0, FALSE, 0, TRUE, 0, TRUE, (int)socket_timeout));
 		close(sd);
 		exit (STATE_OK);
 	}