[Nagiosplug-devel] patch against check_ssh
folkert
folkert at vanheusden.com
Sat Jul 10 17:20:13 CEST 2010
Hi,
Here's a patch against check_ssh. It makes it emit performancedata
(latency) like other checks do.
--- nagios-plugins-1.4.14/plugins/check_ssh.c 2008-11-30 22:23:18.000000000 +0100
+++ nagios-plugins-1.4.14.new/plugins/check_ssh.c 2010-07-10 17:14:01.000000000 +0200
@@ -198,6 +198,18 @@
}
+double
+get_ts (void)
+{
+ struct timeval ts;
+ struct timezone tz;
+
+ gettimeofday(&ts, &tz);
+
+ return (((double)ts.tv_sec) + ((double)ts.tv_usec)/1000000.0);
+}
+
+
/************************************************************************
*
* Try to connect to SSH server at specified server and port
@@ -215,6 +227,7 @@
char *ssh_proto = NULL;
char *ssh_server = NULL;
static char *rev_no = VERSION;
+ double start = get_ts();
result = my_tcp_connect (haddr, hport, &sd);
@@ -251,8 +264,10 @@
}
printf
- (_("SSH OK - %s (protocol %s)\n"),
+ (_("SSH OK - %s (protocol %s)"),
ssh_server, ssh_proto);
+
+ printf ("|latency=%f\n", get_ts() - start);
close(sd);
exit (STATE_OK);
}
Folkert van Heusden
--
Looking for a cheap but fast webhoster with an excellent helpdesk?
http://keetweej.vanheusden.com/redir.php?id=1001
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
More information about the Devel
mailing list