[Nagiosplug-checkins] SF.net SVN: nagiosplug:[2062] nagiosplug/trunk

dermoth at users.sourceforge.net dermoth at users.sourceforge.net
Tue Nov 4 05:46:31 CET 2008


Revision: 2062
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2062&view=rev
Author:   dermoth
Date:     2008-11-04 04:46:31 +0000 (Tue, 04 Nov 2008)

Log Message:
-----------
check_ups now sends a LOGOUT string (debian bug #387001)

Modified Paths:
--------------
    nagiosplug/trunk/NEWS
    nagiosplug/trunk/THANKS.in
    nagiosplug/trunk/plugins/check_ups.c

Modified: nagiosplug/trunk/NEWS
===================================================================
--- nagiosplug/trunk/NEWS	2008-10-22 21:35:15 UTC (rev 2061)
+++ nagiosplug/trunk/NEWS	2008-11-04 04:46:31 UTC (rev 2062)
@@ -5,6 +5,7 @@
 	Updated tinderbox_build script to point to new tinderbox server
 	check_ifoperstatus -n flag now works as expected (sf.net #1569488)
 	check_ifoperstatus now supports ifType based lookup for ifIndex
+	check_ups now sends a LOGOUT string (debian bug #387001)
 
 1.4.13 25th Sept 2008
 	Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)

Modified: nagiosplug/trunk/THANKS.in
===================================================================
--- nagiosplug/trunk/THANKS.in	2008-10-22 21:35:15 UTC (rev 2061)
+++ nagiosplug/trunk/THANKS.in	2008-11-04 04:46:31 UTC (rev 2062)
@@ -238,3 +238,5 @@
 Hilko Bengen
 Sven Nierlein
 Erik Wasser
+Tilman Koschnick
+Olivier 'Babar' Raginel

Modified: nagiosplug/trunk/plugins/check_ups.c
===================================================================
--- nagiosplug/trunk/plugins/check_ups.c	2008-10-22 21:35:15 UTC (rev 2061)
+++ nagiosplug/trunk/plugins/check_ups.c	2008-11-04 04:46:31 UTC (rev 2062)
@@ -398,12 +398,15 @@
 	char temp_buffer[MAX_INPUT_BUFFER];
 	char send_buffer[MAX_INPUT_BUFFER];
 	char *ptr;
+	char *logout = "OK Goodbye\n";
+	int logout_len = strlen(logout);
 	int len;
 
 	*buf=0;
 	
 	/* create the command string to send to the UPS daemon */
-	sprintf (send_buffer, "GET VAR %s %s\n", ups_name, varname);
+	/* Add LOGOUT to avoid read failure logs */
+	sprintf (send_buffer, "GET VAR %s %s\nLOGOUT\n", ups_name, varname);
 
 	/* send the command to the daemon and get a response back */
 	if (process_tcp_request
@@ -415,6 +418,7 @@
 
 	ptr = temp_buffer;
 	len = strlen(ptr);
+	if (len > logout_len && strcmp (ptr + len - logout_len, logout) == 0) len -= logout_len;
 	if (len > 0 && ptr[len-1] == '\n') ptr[len-1]=0;
 	if (strcmp (ptr, "ERR UNKNOWN-UPS") == 0) {
 		printf (_("CRITICAL - no such ups '%s' on that host\n"), ups_name);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list