From 8a449690f3c2c38bb552e3f905c62bfacb631280 Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Mon, 17 Nov 2003 11:45:57 +0000 Subject: 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 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) 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)); } -- cgit v0.10-9-g596f