[Nagiosplug-checkins] nagiosplug/plugins check_ups.c,1.27,1.28

M. Sean Finney seanius at users.sourceforge.net
Thu Oct 6 05:18:19 CEST 2005


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4371

Modified Files:
	check_ups.c 
Log Message:
fix for misreporting temperature in perfdata output for check_ups
(debian bts id: #316534)


Index: check_ups.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ups.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- check_ups.c	4 Mar 2005 21:58:40 -0000	1.27
+++ check_ups.c	6 Oct 2005 12:16:06 -0000	1.28
@@ -98,6 +98,7 @@
 	int result = STATE_UNKNOWN;
 	char *message;
 	char *data;
+	char *tunits;
 	char temp_buffer[MAX_INPUT_BUFFER];
 	double ups_utility_deviation = 0.0;
 	int res;
@@ -281,10 +282,12 @@
 	else {
  		supported_options |= UPS_TEMP;
 		if (temp_output_c) {
+		  tunits="degC";
 		  ups_temperature = atof (temp_buffer);
 		  asprintf (&message, "%sTemp=%3.1fC", message, ups_temperature);
 		}
 		else {
+		  tunits="degF";
 		  ups_temperature = (atof (temp_buffer) * 1.8) + 32;
 		  asprintf (&message, "%sTemp=%3.1fF", message, ups_temperature);
 		}
@@ -297,13 +300,13 @@
 				result = max_state (result, STATE_WARNING);
 			}
 			asprintf (&data, "%s %s", data,
-			          perfdata ("temp", (long)ups_temperature, "degF",
+			          perfdata ("temp", (long)ups_temperature, tunits,
 			                    check_warn, (long)(1000*warning_value),
 			                    check_crit, (long)(1000*critical_value),
 			                    TRUE, 0, FALSE, 0));
 		} else {
 			asprintf (&data, "%s %s", data,
-			          perfdata ("temp", (long)ups_temperature, "degF",
+			          perfdata ("temp", (long)ups_temperature, tunits,
 			                    FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
 		}
 	}





More information about the Commits mailing list