aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2003-11-17 11:45:57 +0000
committerGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2003-11-17 11:45:57 +0000
commit8a449690f3c2c38bb552e3f905c62bfacb631280 (patch)
tree5e50886af1afec8bf9e37f01679e8a5c3035fbcd
parent3d3ebef00de3c21f9ba3cca83002b677f129a6e2 (diff)
downloadmonitoring-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
-rw-r--r--plugins/check_ups.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/check_ups.c b/plugins/check_ups.c
index 335cb993..116e888c 100644
--- a/plugins/check_ups.c
+++ b/plugins/check_ups.c
@@ -87,6 +87,7 @@ main (int argc, char **argv)
textdomain (PACKAGE);
ups_status = strdup ("N/A");
+ data = strdup ("");
if (process_arguments (argc, argv) != OK)
usage ("Invalid command arguments supplied\n");
@@ -165,13 +166,13 @@ main (int argc, char **argv)
else if (check_warn==TRUE && ups_utility_deviation>=warning_value) {
result = max_state (result, STATE_WARNING);
}
- asprintf (&data, "%s ",
+ asprintf (&data, "%s",
perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV",
check_warn, (long)(1000*warning_value),
check_crit, (long)(1000*critical_value),
TRUE, 0, FALSE, 0));
} else {
- asprintf (&data, "%s ",
+ asprintf (&data, "%s",
perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV",
FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
}
@@ -193,13 +194,13 @@ main (int argc, char **argv)
else if (check_warn==TRUE && ups_battery_percent<=warning_value) {
result = max_state (result, STATE_WARNING);
}
- asprintf (&data, "%s ",
+ asprintf (&data, "%s %s", data,
perfdata ("battery", (long)ups_battery_percent, "%",
check_warn, (long)(1000*warning_value),
check_crit, (long)(1000*critical_value),
TRUE, 0, TRUE, 100));
} else {
- asprintf (&data, "%s ",
+ asprintf (&data, "%s %s", data,
perfdata ("battery", (long)ups_battery_percent, "%",
FALSE, 0, FALSE, 0, TRUE, 0, TRUE, 100));
}
@@ -221,13 +222,13 @@ main (int argc, char **argv)
else if (check_warn==TRUE && ups_load_percent>=warning_value) {
result = max_state (result, STATE_WARNING);
}
- asprintf (&data, "%s ",
+ asprintf (&data, "%s %s", data,
perfdata ("load", (long)ups_load_percent, "%",
check_warn, (long)(1000*warning_value),
check_crit, (long)(1000*critical_value),
TRUE, 0, TRUE, 100));
} else {
- asprintf (&data, "%s ",
+ asprintf (&data, "%s %s", data,
perfdata ("load", (long)ups_load_percent, "%",
FALSE, 0, FALSE, 0, TRUE, 0, TRUE, 100));
}
@@ -249,13 +250,13 @@ main (int argc, char **argv)
else if (check_warn == TRUE && ups_temperature>=warning_value) {
result = max_state (result, STATE_WARNING);
}
- asprintf (&data, "%s ",
+ asprintf (&data, "%s %s", data,
perfdata ("temp", (long)ups_temperature, "degF",
check_warn, (long)(1000*warning_value),
check_crit, (long)(1000*critical_value),
TRUE, 0, FALSE, 0));
} else {
- asprintf (&data, "%s ",
+ asprintf (&data, "%s %s", data,
perfdata ("temp", (long)ups_temperature, "degF",
FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
}