fix logout problems
This commit is contained in:
parent
eb6daf88f1
commit
e55ac6cafe
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -6,6 +6,8 @@ nagios-plugins (1.4.12-5) UNRELEASED; urgency=low
|
|||
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@cyconet.org> Thu, 02 Oct 2008 00:45:31 +0200
|
||||
|
||||
|
|
1
debian/patches/00list
vendored
1
debian/patches/00list
vendored
|
@ -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
|
||||
|
|
34
debian/patches/42_check_ups_logoutfix.dpatch
vendored
Normal file
34
debian/patches/42_check_ups_logoutfix.dpatch
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
#! /bin/sh /usr/share/dpatch/dpatch-run
|
||||
## 42_check_ups_logoutfix.dpatch by Olivier 'Babar' Raginel <nagios@babar.us>
|
||||
##
|
||||
## DP: Fixing Lougout
|
||||
|
||||
@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);
|
Loading…
Reference in a new issue