summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins/check_ups.c b/plugins/check_ups.c
index 154508d..bbd963a 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);