summaryrefslogtreecommitdiffstats
path: root/plugins/check_ups.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2023-07-23 19:58:13 (GMT)
committerGitHub <noreply@github.com>2023-07-23 19:58:13 (GMT)
commit7c3098270c5481f64438525be5883f070ebc16a1 (patch)
tree8e3b4a532717659649954b879fb685fce353e863 /plugins/check_ups.c
parentc22c277b3df4884719c833daaffca59167abd14a (diff)
parentaf06d34071608641295eecd46edb0c4dbde13872 (diff)
downloadmonitoring-plugins-7c3098270c5481f64438525be5883f070ebc16a1.tar.gz
Merge branch 'master' into check_swap_scanf_expressionsrefs/pull/1876/head
Diffstat (limited to 'plugins/check_ups.c')
-rw-r--r--plugins/check_ups.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/check_ups.c b/plugins/check_ups.c
index 12bce21..68737c4 100644
--- a/plugins/check_ups.c
+++ b/plugins/check_ups.c
@@ -89,7 +89,7 @@ char *ups_status;
89int temp_output_c = 0; 89int temp_output_c = 0;
90 90
91int determine_status (void); 91int determine_status (void);
92int get_ups_variable (const char *, char *, size_t); 92int get_ups_variable (const char *, char *);
93 93
94int process_arguments (int, char **); 94int process_arguments (int, char **);
95int validate_arguments (void); 95int validate_arguments (void);
@@ -189,7 +189,7 @@ main (int argc, char **argv)
189 } 189 }
190 190
191 /* get the ups utility voltage if possible */ 191 /* get the ups utility voltage if possible */
192 res=get_ups_variable ("input.voltage", temp_buffer, sizeof (temp_buffer)); 192 res=get_ups_variable ("input.voltage", temp_buffer);
193 if (res == NOSUCHVAR) supported_options &= ~UPS_UTILITY; 193 if (res == NOSUCHVAR) supported_options &= ~UPS_UTILITY;
194 else if (res != OK) 194 else if (res != OK)
195 return STATE_CRITICAL; 195 return STATE_CRITICAL;
@@ -224,7 +224,7 @@ main (int argc, char **argv)
224 } 224 }
225 225
226 /* get the ups battery percent if possible */ 226 /* get the ups battery percent if possible */
227 res=get_ups_variable ("battery.charge", temp_buffer, sizeof (temp_buffer)); 227 res=get_ups_variable ("battery.charge", temp_buffer);
228 if (res == NOSUCHVAR) supported_options &= ~UPS_BATTPCT; 228 if (res == NOSUCHVAR) supported_options &= ~UPS_BATTPCT;
229 else if ( res != OK) 229 else if ( res != OK)
230 return STATE_CRITICAL; 230 return STATE_CRITICAL;
@@ -253,7 +253,7 @@ main (int argc, char **argv)
253 } 253 }
254 254
255 /* get the ups load percent if possible */ 255 /* get the ups load percent if possible */
256 res=get_ups_variable ("ups.load", temp_buffer, sizeof (temp_buffer)); 256 res=get_ups_variable ("ups.load", temp_buffer);
257 if ( res == NOSUCHVAR ) supported_options &= ~UPS_LOADPCT; 257 if ( res == NOSUCHVAR ) supported_options &= ~UPS_LOADPCT;
258 else if ( res != OK) 258 else if ( res != OK)
259 return STATE_CRITICAL; 259 return STATE_CRITICAL;
@@ -282,7 +282,7 @@ main (int argc, char **argv)
282 } 282 }
283 283
284 /* get the ups temperature if possible */ 284 /* get the ups temperature if possible */
285 res=get_ups_variable ("ups.temperature", temp_buffer, sizeof (temp_buffer)); 285 res=get_ups_variable ("ups.temperature", temp_buffer);
286 if ( res == NOSUCHVAR ) supported_options &= ~UPS_TEMP; 286 if ( res == NOSUCHVAR ) supported_options &= ~UPS_TEMP;
287 else if ( res != OK) 287 else if ( res != OK)
288 return STATE_CRITICAL; 288 return STATE_CRITICAL;
@@ -342,7 +342,7 @@ determine_status (void)
342 char *ptr; 342 char *ptr;
343 int res; 343 int res;
344 344
345 res=get_ups_variable ("ups.status", recv_buffer, sizeof (recv_buffer)); 345 res=get_ups_variable ("ups.status", recv_buffer);
346 if (res == NOSUCHVAR) return OK; 346 if (res == NOSUCHVAR) return OK;
347 if (res != STATE_OK) { 347 if (res != STATE_OK) {
348 printf ("%s\n", _("Invalid response received from host")); 348 printf ("%s\n", _("Invalid response received from host"));
@@ -388,7 +388,7 @@ determine_status (void)
388 388
389/* gets a variable value for a specific UPS */ 389/* gets a variable value for a specific UPS */
390int 390int
391get_ups_variable (const char *varname, char *buf, size_t buflen) 391get_ups_variable (const char *varname, char *buf)
392{ 392{
393 /* char command[MAX_INPUT_BUFFER]; */ 393 /* char command[MAX_INPUT_BUFFER]; */
394 char temp_buffer[MAX_INPUT_BUFFER]; 394 char temp_buffer[MAX_INPUT_BUFFER];