[Nagiosplug-devel] patch against check_ssh

folkert folkert at vanheusden.com
Sat Jul 10 21:20:12 CEST 2010


> > Here's a patch against check_ssh. It makes it emit performancedata
> > (latency) like other checks do.
> 
> Thanks, however it will have to use the exported perfdata functions,
> which won't be very hard to do anyway. See check_tcp as an example (look
> for fperfdata). You may want to use deltime too from utils.h.
> Using the provided functions helps keeping all plugins to a standard
> level and will greatly help conversion to a plugins library if/when we
> manage to code it :)
> Also I think "time=" would be a more appropriate label; most other
> plugins uses it for the latency and some tools might better recognise it.
> I will commit it if you can fix the above issue.

Hi,

Here's the patch again for check_ssh.
check_procs will be in an other mail

--- 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 21:18:12.000000000 +0200
@@ -215,6 +215,8 @@
 	char *ssh_proto = NULL;
 	char *ssh_server = NULL;
 	static char *rev_no = VERSION;
+	struct timeval start;
+	gettimeofday (&start, NULL);
 
 	result = my_tcp_connect (haddr, hport, &sd);
 
@@ -251,8 +253,16 @@
 		}
 
 		printf
-			(_("SSH OK - %s (protocol %s)\n"),
+			(_("SSH OK - %s (protocol %s)"),
 			 ssh_server, ssh_proto);
+
+                printf("|%s\n",   
+                                fperfdata ("time", delta_time(start), "s",
+                                FALSE, 0,
+                                FALSE, 0,
+                                FALSE, 0,
+                                FALSE, 0)
+                        );
 		close(sd);
 		exit (STATE_OK);
 	}


Folkert van Heusden

-- 
MultiTail er et flexible tool for å kontrolere Logfiles og commandoer.
Med filtrer, farger, sammenføringer, forskeliger ansikter etc.
http://www.vanheusden.com/multitail/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com




More information about the Devel mailing list