From: Thomas Guyot-Sionnest Date: Sat, 26 Mar 2011 19:44:38 +0000 (-0400) Subject: Add perfdata to check_ssh (#3244097 - Marco Beck) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1bc7a4a198aefde2389c9c1685baed0da7856bf5;p=nagiosplug.git Add perfdata to check_ssh (#3244097 - Marco Beck) --- diff --git a/NEWS b/NEWS index d7fea27..fcaa9c1 100644 --- a/NEWS +++ b/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) diff --git a/THANKS.in b/THANKS.in index 387a379..cb8d26c 100644 --- a/THANKS.in +++ b/THANKS.in @@ -267,3 +267,4 @@ Craig Leres Brian Landers Ryan Kelly Stéphane Urbanovski +Marco Beck diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c index 2509b86..3bbf44d 100644 --- a/plugins/check_ssh.c +++ b/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); }