[Nagiosplug-devel] performance data patch for check_ping.c

Christian Schneemann cschneemann at suse.de
Tue May 6 16:58:20 CEST 2008


On Wednesday April 23 2008 08:36:18 pm Thomas Guyot-Sionnest wrote:
> Christian Schneemann wrote:
[...]
>
> Thanks for your time,
Hi,
thanks for the small documentation, I gave it a new try ;)

With the test if the threshold is set and with packetloss.

--- plugins/check_ping.c
+++ plugins/check_ping.c
@@ -165,7 +165,11 @@
 							state_text (this_result), warn_text, pl, rta);
 		if (display_html == TRUE)
 			printf ("</A>");
-		printf ("\n");
+		char * data_rta = NULL;
+		char * data_pl = NULL;
+		asprintf(&data_rta, "%s", fperfdata ("rta", (double) rta, "ms", 
wrta>0?TRUE:FALSE, wrta, crta>0?TRUE:FALSE, crta, TRUE, 0, FALSE, 0));
+		asprintf(&data_pl, "%s", perfdata ("pl", (long) pl, "%", wpl>0?TRUE:FALSE, 
wpl, cpl>0?TRUE:FALSE, cpl, FALSE, 0, FALSE, 0));
+		printf("|%s %s\n",data_rta, data_pl);
 
 		if (verbose >= 2)
 			printf ("%f:%d%% %f:%d%%\n", wrta, wpl, crta, cpl);

I hope it becomes better and not worther.

Greetings,


-- 
Christian Schneemann

-------------------------------------
SUSE LINUX Products GmbH,
Maxfeldstr. 5, D - 90409 Nürnberg

Phone:  +49 (0)911 - 740 53 0
e-mail: cschneemann at suse.de
-------------------------------------
SUSE LINUX Products GmbH, GF: Markus Rex
HRB 16746 (AG Nürnberg)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nagios-plugins-perfdata.patch
Type: text/x-diff
Size: 633 bytes
Desc: not available
URL: <http://nagios-plugins.org/archive/devel/attachments/20080506/d6e56681/attachment.patch>


More information about the Devel mailing list