diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-11-04 04:46:31 +0000 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-11-04 04:46:31 +0000 |
commit | 47fddad5fd5808cd5540a9c8c1a72d8a66348546 (patch) | |
tree | 8071260130372b4a8d6529a4c7790d5e08341273 | |
parent | 96d628142872385215bbe4c535f3fcd1195505eb (diff) | |
download | monitoring-plugins-47fddad5fd5808cd5540a9c8c1a72d8a66348546.tar.gz |
check_ups now sends a LOGOUT string (debian bug #387001)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2062 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | THANKS.in | 2 | ||||
-rw-r--r-- | plugins/check_ups.c | 6 |
3 files changed, 8 insertions, 1 deletions
@@ -5,6 +5,7 @@ This file documents the major additions and syntax changes between releases. | |||
5 | Updated tinderbox_build script to point to new tinderbox server | 5 | Updated tinderbox_build script to point to new tinderbox server |
6 | check_ifoperstatus -n flag now works as expected (sf.net #1569488) | 6 | check_ifoperstatus -n flag now works as expected (sf.net #1569488) |
7 | check_ifoperstatus now supports ifType based lookup for ifIndex | 7 | check_ifoperstatus now supports ifType based lookup for ifIndex |
8 | check_ups now sends a LOGOUT string (debian bug #387001) | ||
8 | 9 | ||
9 | 1.4.13 25th Sept 2008 | 10 | 1.4.13 25th Sept 2008 |
10 | Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen) | 11 | Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen) |
@@ -238,3 +238,5 @@ Rob Windsor | |||
238 | Hilko Bengen | 238 | Hilko Bengen |
239 | Sven Nierlein | 239 | Sven Nierlein |
240 | Erik Wasser | 240 | Erik Wasser |
241 | Tilman Koschnick | ||
242 | Olivier 'Babar' Raginel | ||
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 154508db..bbd963a9 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c | |||
@@ -398,12 +398,15 @@ get_ups_variable (const char *varname, char *buf, size_t buflen) | |||
398 | char temp_buffer[MAX_INPUT_BUFFER]; | 398 | char temp_buffer[MAX_INPUT_BUFFER]; |
399 | char send_buffer[MAX_INPUT_BUFFER]; | 399 | char send_buffer[MAX_INPUT_BUFFER]; |
400 | char *ptr; | 400 | char *ptr; |
401 | char *logout = "OK Goodbye\n"; | ||
402 | int logout_len = strlen(logout); | ||
401 | int len; | 403 | int len; |
402 | 404 | ||
403 | *buf=0; | 405 | *buf=0; |
404 | 406 | ||
405 | /* create the command string to send to the UPS daemon */ | 407 | /* create the command string to send to the UPS daemon */ |
406 | sprintf (send_buffer, "GET VAR %s %s\n", ups_name, varname); | 408 | /* Add LOGOUT to avoid read failure logs */ |
409 | sprintf (send_buffer, "GET VAR %s %s\nLOGOUT\n", ups_name, varname); | ||
407 | 410 | ||
408 | /* send the command to the daemon and get a response back */ | 411 | /* send the command to the daemon and get a response back */ |
409 | if (process_tcp_request | 412 | if (process_tcp_request |
@@ -415,6 +418,7 @@ get_ups_variable (const char *varname, char *buf, size_t buflen) | |||
415 | 418 | ||
416 | ptr = temp_buffer; | 419 | ptr = temp_buffer; |
417 | len = strlen(ptr); | 420 | len = strlen(ptr); |
421 | if (len > logout_len && strcmp (ptr + len - logout_len, logout) == 0) len -= logout_len; | ||
418 | if (len > 0 && ptr[len-1] == '\n') ptr[len-1]=0; | 422 | if (len > 0 && ptr[len-1] == '\n') ptr[len-1]=0; |
419 | if (strcmp (ptr, "ERR UNKNOWN-UPS") == 0) { | 423 | if (strcmp (ptr, "ERR UNKNOWN-UPS") == 0) { |
420 | printf (_("CRITICAL - no such ups '%s' on that host\n"), ups_name); | 424 | printf (_("CRITICAL - no such ups '%s' on that host\n"), ups_name); |