[Pkg-nagios-changes] [pkg-nagios] r1610 - in nagios-plugins/trunk/debian: . patches

Jan Wagner waja at alioth.debian.org
Fri Jan 30 21:40:48 UTC 2009


tags 387001 pending
thanks

Author: waja
Date: 2009-01-30 21:40:48 +0000 (Fri, 30 Jan 2009)
New Revision: 1610

Added:
   nagios-plugins/trunk/debian/patches/42_check_ups_logoutfix.dpatch
Modified:
   nagios-plugins/trunk/debian/changelog
   nagios-plugins/trunk/debian/patches/00list
Log:
fix logout problems

Modified: nagios-plugins/trunk/debian/changelog
===================================================================
--- nagios-plugins/trunk/debian/changelog	2009-01-30 20:28:44 UTC (rev 1609)
+++ nagios-plugins/trunk/debian/changelog	2009-01-30 21:40:48 UTC (rev 1610)
@@ -6,6 +6,8 @@
     it's behavior in etch (Closes: #505610)
   * add -e to all preconfigured check commands using check_disk, to only display
     effected partitions, when warning or critical (Closes: #395389)
+  * add 42_check_ups_logoutfix.dpatch to fix logout problem with check_ups
+    (Closes: #387001)
 
  -- Jan Wagner <waja at cyconet.org>  Thu, 02 Oct 2008 00:45:31 +0200
 

Modified: nagios-plugins/trunk/debian/patches/00list
===================================================================
--- nagios-plugins/trunk/debian/patches/00list	2009-01-30 20:28:44 UTC (rev 1609)
+++ nagios-plugins/trunk/debian/patches/00list	2009-01-30 21:40:48 UTC (rev 1610)
@@ -16,4 +16,5 @@
 39_check_dig_options.dpatch
 40_check_http_status_line.dpatch
 41_check_http_fix_http_header.dpatch
+42_check_ups_logoutfix.dpatch
 50_misc_typos.dpatch

Added: nagios-plugins/trunk/debian/patches/42_check_ups_logoutfix.dpatch
===================================================================
--- nagios-plugins/trunk/debian/patches/42_check_ups_logoutfix.dpatch	                        (rev 0)
+++ nagios-plugins/trunk/debian/patches/42_check_ups_logoutfix.dpatch	2009-01-30 21:40:48 UTC (rev 1610)
@@ -0,0 +1,34 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 42_check_ups_logoutfix.dpatch by Olivier 'Babar' Raginel <nagios at babar.us>
+##
+## DP: Fixing Lougout
+
+ at DPATCH@
+diff -urNad nagios-plugins-1.4.12~/plugins/check_ups.c nagios-plugins-1.4.12/plugins/check_ups.c
+--- nagios-plugins-1.4.12~/plugins/check_ups.c	2008-05-07 12:02:42.000000000 +0200
++++ nagios-plugins-1.4.12/plugins/check_ups.c	2009-01-30 22:31:37.000000000 +0100
+@@ -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);




More information about the Pkg-nagios-changes mailing list