aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_ssh.c
diff options
context:
space:
mode:
authorGravatar Thomas Guyot-Sionnest <dermoth@aei.ca> 2011-03-26 15:44:38 -0400
committerGravatar Thomas Guyot-Sionnest <dermoth@aei.ca> 2011-03-26 15:44:38 -0400
commit1bc7a4a198aefde2389c9c1685baed0da7856bf5 (patch)
treefeba24065e48917034c759a2b055b83efeac3441 /plugins/check_ssh.c
parentd16f3fb0a9bb37cc1ce73ef14b5de83e907ef23c (diff)
downloadmonitoring-plugins-1bc7a4a198aefde2389c9c1685baed0da7856bf5.tar.gz
Add perfdata to check_ssh (#3244097 - Marco Beck)
Diffstat (limited to 'plugins/check_ssh.c')
-rw-r--r--plugins/check_ssh.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index 2509b860..3bbf44dc 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);
}