summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/check_ups.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/check_ups.c b/plugins/check_ups.c
index e11332f..786cedc 100644
--- a/plugins/check_ups.c
+++ b/plugins/check_ups.c
@@ -98,6 +98,7 @@ main (int argc, char **argv)
98 int result = STATE_UNKNOWN; 98 int result = STATE_UNKNOWN;
99 char *message; 99 char *message;
100 char *data; 100 char *data;
101 char *tunits;
101 char temp_buffer[MAX_INPUT_BUFFER]; 102 char temp_buffer[MAX_INPUT_BUFFER];
102 double ups_utility_deviation = 0.0; 103 double ups_utility_deviation = 0.0;
103 int res; 104 int res;
@@ -281,10 +282,12 @@ main (int argc, char **argv)
281 else { 282 else {
282 supported_options |= UPS_TEMP; 283 supported_options |= UPS_TEMP;
283 if (temp_output_c) { 284 if (temp_output_c) {
285 tunits="degC";
284 ups_temperature = atof (temp_buffer); 286 ups_temperature = atof (temp_buffer);
285 asprintf (&message, "%sTemp=%3.1fC", message, ups_temperature); 287 asprintf (&message, "%sTemp=%3.1fC", message, ups_temperature);
286 } 288 }
287 else { 289 else {
290 tunits="degF";
288 ups_temperature = (atof (temp_buffer) * 1.8) + 32; 291 ups_temperature = (atof (temp_buffer) * 1.8) + 32;
289 asprintf (&message, "%sTemp=%3.1fF", message, ups_temperature); 292 asprintf (&message, "%sTemp=%3.1fF", message, ups_temperature);
290 } 293 }
@@ -297,13 +300,13 @@ main (int argc, char **argv)
297 result = max_state (result, STATE_WARNING); 300 result = max_state (result, STATE_WARNING);
298 } 301 }
299 asprintf (&data, "%s %s", data, 302 asprintf (&data, "%s %s", data,
300 perfdata ("temp", (long)ups_temperature, "degF", 303 perfdata ("temp", (long)ups_temperature, tunits,
301 check_warn, (long)(1000*warning_value), 304 check_warn, (long)(1000*warning_value),
302 check_crit, (long)(1000*critical_value), 305 check_crit, (long)(1000*critical_value),
303 TRUE, 0, FALSE, 0)); 306 TRUE, 0, FALSE, 0));
304 } else { 307 } else {
305 asprintf (&data, "%s %s", data, 308 asprintf (&data, "%s %s", data,
306 perfdata ("temp", (long)ups_temperature, "degF", 309 perfdata ("temp", (long)ups_temperature, tunits,
307 FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); 310 FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
308 } 311 }
309 } 312 }