diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2011-03-26 15:44:38 -0400 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2011-03-26 15:44:38 -0400 |
commit | 1bc7a4a198aefde2389c9c1685baed0da7856bf5 (patch) | |
tree | feba24065e48917034c759a2b055b83efeac3441 /plugins | |
parent | d16f3fb0a9bb37cc1ce73ef14b5de83e907ef23c (diff) | |
download | monitoring-plugins-1bc7a4a198aefde2389c9c1685baed0da7856bf5.tar.gz |
Add perfdata to check_ssh (#3244097 - Marco Beck)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_ssh.c | 11 |
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) | |||
215 | char *ssh_proto = NULL; | 215 | char *ssh_proto = NULL; |
216 | char *ssh_server = NULL; | 216 | char *ssh_server = NULL; |
217 | static char *rev_no = VERSION; | 217 | static char *rev_no = VERSION; |
218 | struct timeval tv; | ||
219 | double elapsed_time; | ||
220 | |||
221 | gettimeofday(&tv, NULL); | ||
218 | 222 | ||
219 | result = my_tcp_connect (haddr, hport, &sd); | 223 | result = my_tcp_connect (haddr, hport, &sd); |
220 | 224 | ||
@@ -250,9 +254,12 @@ ssh_connect (char *haddr, int hport, char *remote_version) | |||
250 | exit (STATE_WARNING); | 254 | exit (STATE_WARNING); |
251 | } | 255 | } |
252 | 256 | ||
257 | elapsed_time = (double)deltime(tv) / 1.0e6; | ||
258 | |||
253 | printf | 259 | printf |
254 | (_("SSH OK - %s (protocol %s)\n"), | 260 | (_("SSH OK - %s (protocol %s) | %s\n"), |
255 | ssh_server, ssh_proto); | 261 | ssh_server, ssh_proto, fperfdata("time", elapsed_time, "s", |
262 | FALSE, 0, FALSE, 0, TRUE, 0, TRUE, (int)socket_timeout)); | ||
256 | close(sd); | 263 | close(sd); |
257 | exit (STATE_OK); | 264 | exit (STATE_OK); |
258 | } | 265 | } |