[Pkg-nagios-devel] Bug#387001: nagios-plugins-basic: check_ups doesn't disconnect cleanly

Tilman Koschnick til at subnetz.org
Mon Sep 11 15:53:53 UTC 2006

Package: nagios-plugins-basic
Severity: normal


everytime check_ups connects to my upsd, the following line is left in
my syslog:

Sep 11 17:39:09 holly upsd[15381]: Host disconnected (read failure)

What happens is that check_ups drops the connection to upsd as soon as
it has queried for a variable. upsd expects 'LOGOUT' before terminating
the connection, and happily writes "Client on logged out" to
syslog if it sees it.

This is slightly annoying in conjunction with tools like logcheck: While
I'm quite happy to ignore the "logged out" line in a upsd-specific rule, the
word "failure" triggers a global logcheck rule and notifies me hour for

A quick hack is to add "LOGOUT\n" to the query string:

--- check_ups.c	(revision 2)
+++ check_ups.c	(local)
@@ -399,7 +399,7 @@
 	/* create the command string to send to the UPS daemon */
-	sprintf (send_buffer, "GET VAR %s %s\n", ups_name, varname);
+	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

Now, I always get the "logged out" syslog entry, but every now and then,
check_ups fails to parse the response. I guess there is a race condition
between check_ups parsing the answer to the GET VAR query and upsd
answering the LOGOUT query.

Cheers, Til

-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.16-2-686-smp
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages nagios-plugins-basic depends on:
ii  iputils-ping          3:20020927-2       Tools to test the reachability of 
ii  libc6                 2.3.2.ds1-22sarge4 GNU C Library: Shared libraries an
ii  libssl0.9.7           0.9.7e-3sarge2     SSL shared libraries
ii  procps                1:3.2.1-2          The /proc file system utilities

-- no debconf information

More information about the Pkg-nagios-devel mailing list