diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-11-17 11:45:57 (GMT) |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-11-17 11:45:57 (GMT) |
commit | 8a449690f3c2c38bb552e3f905c62bfacb631280 (patch) | |
tree | 5e50886af1afec8bf9e37f01679e8a5c3035fbcd /plugins/check_ups.c | |
parent | 3d3ebef00de3c21f9ba3cca83002b677f129a6e2 (diff) | |
download | monitoring-plugins-8a449690f3c2c38bb552e3f905c62bfacb631280.tar.gz |
bugfix - each supported option was overwriting the previous perfdata
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@771 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_ups.c')
-rw-r--r-- | plugins/check_ups.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 335cb99..116e888 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c | |||
@@ -87,6 +87,7 @@ main (int argc, char **argv) | |||
87 | textdomain (PACKAGE); | 87 | textdomain (PACKAGE); |
88 | 88 | ||
89 | ups_status = strdup ("N/A"); | 89 | ups_status = strdup ("N/A"); |
90 | data = strdup (""); | ||
90 | 91 | ||
91 | if (process_arguments (argc, argv) != OK) | 92 | if (process_arguments (argc, argv) != OK) |
92 | usage ("Invalid command arguments supplied\n"); | 93 | usage ("Invalid command arguments supplied\n"); |
@@ -165,13 +166,13 @@ main (int argc, char **argv) | |||
165 | else if (check_warn==TRUE && ups_utility_deviation>=warning_value) { | 166 | else if (check_warn==TRUE && ups_utility_deviation>=warning_value) { |
166 | result = max_state (result, STATE_WARNING); | 167 | result = max_state (result, STATE_WARNING); |
167 | } | 168 | } |
168 | asprintf (&data, "%s ", | 169 | asprintf (&data, "%s", |
169 | perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | 170 | perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", |
170 | check_warn, (long)(1000*warning_value), | 171 | check_warn, (long)(1000*warning_value), |
171 | check_crit, (long)(1000*critical_value), | 172 | check_crit, (long)(1000*critical_value), |
172 | TRUE, 0, FALSE, 0)); | 173 | TRUE, 0, FALSE, 0)); |
173 | } else { | 174 | } else { |
174 | asprintf (&data, "%s ", | 175 | asprintf (&data, "%s", |
175 | perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | 176 | perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", |
176 | FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | 177 | FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); |
177 | } | 178 | } |
@@ -193,13 +194,13 @@ main (int argc, char **argv) | |||
193 | else if (check_warn==TRUE && ups_battery_percent<=warning_value) { | 194 | else if (check_warn==TRUE && ups_battery_percent<=warning_value) { |
194 | result = max_state (result, STATE_WARNING); | 195 | result = max_state (result, STATE_WARNING); |
195 | } | 196 | } |
196 | asprintf (&data, "%s ", | 197 | asprintf (&data, "%s %s", data, |
197 | perfdata ("battery", (long)ups_battery_percent, "%", | 198 | perfdata ("battery", (long)ups_battery_percent, "%", |
198 | check_warn, (long)(1000*warning_value), | 199 | check_warn, (long)(1000*warning_value), |
199 | check_crit, (long)(1000*critical_value), | 200 | check_crit, (long)(1000*critical_value), |
200 | TRUE, 0, TRUE, 100)); | 201 | TRUE, 0, TRUE, 100)); |
201 | } else { | 202 | } else { |
202 | asprintf (&data, "%s ", | 203 | asprintf (&data, "%s %s", data, |
203 | perfdata ("battery", (long)ups_battery_percent, "%", | 204 | perfdata ("battery", (long)ups_battery_percent, "%", |
204 | FALSE, 0, FALSE, 0, TRUE, 0, TRUE, 100)); | 205 | FALSE, 0, FALSE, 0, TRUE, 0, TRUE, 100)); |
205 | } | 206 | } |
@@ -221,13 +222,13 @@ main (int argc, char **argv) | |||
221 | else if (check_warn==TRUE && ups_load_percent>=warning_value) { | 222 | else if (check_warn==TRUE && ups_load_percent>=warning_value) { |
222 | result = max_state (result, STATE_WARNING); | 223 | result = max_state (result, STATE_WARNING); |
223 | } | 224 | } |
224 | asprintf (&data, "%s ", | 225 | asprintf (&data, "%s %s", data, |
225 | perfdata ("load", (long)ups_load_percent, "%", | 226 | perfdata ("load", (long)ups_load_percent, "%", |
226 | check_warn, (long)(1000*warning_value), | 227 | check_warn, (long)(1000*warning_value), |
227 | check_crit, (long)(1000*critical_value), | 228 | check_crit, (long)(1000*critical_value), |
228 | TRUE, 0, TRUE, 100)); | 229 | TRUE, 0, TRUE, 100)); |
229 | } else { | 230 | } else { |
230 | asprintf (&data, "%s ", | 231 | asprintf (&data, "%s %s", data, |
231 | perfdata ("load", (long)ups_load_percent, "%", | 232 | perfdata ("load", (long)ups_load_percent, "%", |
232 | FALSE, 0, FALSE, 0, TRUE, 0, TRUE, 100)); | 233 | FALSE, 0, FALSE, 0, TRUE, 0, TRUE, 100)); |
233 | } | 234 | } |
@@ -249,13 +250,13 @@ main (int argc, char **argv) | |||
249 | else if (check_warn == TRUE && ups_temperature>=warning_value) { | 250 | else if (check_warn == TRUE && ups_temperature>=warning_value) { |
250 | result = max_state (result, STATE_WARNING); | 251 | result = max_state (result, STATE_WARNING); |
251 | } | 252 | } |
252 | asprintf (&data, "%s ", | 253 | asprintf (&data, "%s %s", data, |
253 | perfdata ("temp", (long)ups_temperature, "degF", | 254 | perfdata ("temp", (long)ups_temperature, "degF", |
254 | check_warn, (long)(1000*warning_value), | 255 | check_warn, (long)(1000*warning_value), |
255 | check_crit, (long)(1000*critical_value), | 256 | check_crit, (long)(1000*critical_value), |
256 | TRUE, 0, FALSE, 0)); | 257 | TRUE, 0, FALSE, 0)); |
257 | } else { | 258 | } else { |
258 | asprintf (&data, "%s ", | 259 | asprintf (&data, "%s %s", data, |
259 | perfdata ("temp", (long)ups_temperature, "degF", | 260 | perfdata ("temp", (long)ups_temperature, "degF", |
260 | FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | 261 | FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); |
261 | } | 262 | } |