From b95e3d7446f33784f0647dc5d60a4b2d0a750a8a Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:25:19 +0200 Subject: check_ups: clang-format --- plugins/check_ups.c | 102 ++++++++++++++++------------------------------------ 1 file changed, 31 insertions(+), 71 deletions(-) diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 380ff3bc..1d313298 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -141,7 +141,6 @@ int main(int argc, char **argv) { return STATE_CRITICAL; } - if (supported_options & UPS_STATUS) { ups_status = strdup(""); @@ -151,8 +150,7 @@ int main(int argc, char **argv) { if (config.status & UPSSTATUS_OFF) { xasprintf(&ups_status, "Off"); result = STATE_CRITICAL; - } else if ((config.status & (UPSSTATUS_OB | UPSSTATUS_LB)) == - (UPSSTATUS_OB | UPSSTATUS_LB)) { + } else if ((config.status & (UPSSTATUS_OB | UPSSTATUS_LB)) == (UPSSTATUS_OB | UPSSTATUS_LB)) { xasprintf(&ups_status, _("On Battery, Low Battery")); result = STATE_CRITICAL; } else { @@ -171,8 +169,7 @@ int main(int argc, char **argv) { xasprintf(&ups_status, "%s%s", ups_status, _(", Calibrating")); } if (config.status & UPSSTATUS_RB) { - xasprintf(&ups_status, "%s%s", ups_status, - _(", Replace Battery")); + xasprintf(&ups_status, "%s%s", ups_status, _(", Replace Battery")); result = max_state(result, STATE_WARNING); } if (config.status & UPSSTATUS_BYPASS) { @@ -233,24 +230,16 @@ int main(int argc, char **argv) { } if (config.check_variable == UPS_UTILITY) { - if (config.check_crit && - ups_utility_deviation >= config.critical_value) { + if (config.check_crit && ups_utility_deviation >= config.critical_value) { result = STATE_CRITICAL; - } else if (config.check_warn && - ups_utility_deviation >= config.warning_value) { + } else if (config.check_warn && ups_utility_deviation >= config.warning_value) { result = max_state(result, STATE_WARNING); } xasprintf(&data, "%s", - perfdata("voltage", (long)(1000 * ups_utility_voltage), - "mV", config.check_warn, - (long)(1000 * config.warning_value), - config.check_crit, - (long)(1000 * config.critical_value), true, 0, - false, 0)); + perfdata("voltage", (long)(1000 * ups_utility_voltage), "mV", config.check_warn, (long)(1000 * config.warning_value), config.check_crit, + (long)(1000 * config.critical_value), true, 0, false, 0)); } else { - xasprintf(&data, "%s", - perfdata("voltage", (long)(1000 * ups_utility_voltage), - "mV", false, 0, false, 0, true, 0, false, 0)); + xasprintf(&data, "%s", perfdata("voltage", (long)(1000 * ups_utility_voltage), "mV", false, 0, false, 0, true, 0, false, 0)); } } @@ -268,22 +257,16 @@ int main(int argc, char **argv) { xasprintf(&message, "%sBatt=%3.1f%% ", message, ups_battery_percent); if (config.check_variable == UPS_BATTPCT) { - if (config.check_crit && - ups_battery_percent <= config.critical_value) { + if (config.check_crit && ups_battery_percent <= config.critical_value) { result = STATE_CRITICAL; - } else if (config.check_warn && - ups_battery_percent <= config.warning_value) { + } else if (config.check_warn && ups_battery_percent <= config.warning_value) { result = max_state(result, STATE_WARNING); } xasprintf(&data, "%s %s", data, - perfdata("battery", (long)ups_battery_percent, "%", - config.check_warn, (long)(config.warning_value), - config.check_crit, (long)(config.critical_value), - true, 0, true, 100)); + perfdata("battery", (long)ups_battery_percent, "%", config.check_warn, (long)(config.warning_value), config.check_crit, (long)(config.critical_value), true, + 0, true, 100)); } else { - xasprintf(&data, "%s %s", data, - perfdata("battery", (long)ups_battery_percent, "%", false, - 0, false, 0, true, 0, true, 100)); + xasprintf(&data, "%s %s", data, perfdata("battery", (long)ups_battery_percent, "%", false, 0, false, 0, true, 0, true, 100)); } } @@ -301,22 +284,16 @@ int main(int argc, char **argv) { xasprintf(&message, "%sLoad=%3.1f%% ", message, ups_load_percent); if (config.check_variable == UPS_LOADPCT) { - if (config.check_crit && - ups_load_percent >= config.critical_value) { + if (config.check_crit && ups_load_percent >= config.critical_value) { result = STATE_CRITICAL; - } else if (config.check_warn && - ups_load_percent >= config.warning_value) { + } else if (config.check_warn && ups_load_percent >= config.warning_value) { result = max_state(result, STATE_WARNING); } xasprintf(&data, "%s %s", data, - perfdata("load", (long)ups_load_percent, "%", - config.check_warn, (long)(config.warning_value), - config.check_crit, (long)(config.critical_value), - true, 0, true, 100)); + perfdata("load", (long)ups_load_percent, "%", config.check_warn, (long)(config.warning_value), config.check_crit, (long)(config.critical_value), true, 0, + true, 100)); } else { - xasprintf(&data, "%s %s", data, - perfdata("load", (long)ups_load_percent, "%", false, 0, - false, 0, true, 0, true, 100)); + xasprintf(&data, "%s %s", data, perfdata("load", (long)ups_load_percent, "%", false, 0, false, 0, true, 0, true, 100)); } } @@ -345,19 +322,14 @@ int main(int argc, char **argv) { if (config.check_variable == UPS_TEMP) { if (config.check_crit && ups_temperature >= config.critical_value) { result = STATE_CRITICAL; - } else if (config.check_warn && - ups_temperature >= config.warning_value) { + } else if (config.check_warn && ups_temperature >= config.warning_value) { result = max_state(result, STATE_WARNING); } xasprintf(&data, "%s %s", data, - perfdata("temp", (long)ups_temperature, tunits, - config.check_warn, (long)(config.warning_value), - config.check_crit, (long)(config.critical_value), - true, 0, false, 0)); + perfdata("temp", (long)ups_temperature, tunits, config.check_warn, (long)(config.warning_value), config.check_crit, (long)(config.critical_value), true, 0, + false, 0)); } else { - xasprintf(&data, "%s %s", data, - perfdata("temp", (long)ups_temperature, tunits, false, 0, - false, 0, true, 0, false, 0)); + xasprintf(&data, "%s %s", data, perfdata("temp", (long)ups_temperature, tunits, false, 0, false, 0, true, 0, false, 0)); } } @@ -376,19 +348,14 @@ int main(int argc, char **argv) { if (config.check_variable == UPS_REALPOWER) { if (config.check_crit && ups_realpower >= config.critical_value) { result = STATE_CRITICAL; - } else if (config.check_warn && - ups_realpower >= config.warning_value) { + } else if (config.check_warn && ups_realpower >= config.warning_value) { result = max_state(result, STATE_WARNING); } xasprintf(&data, "%s %s", data, - perfdata("realpower", (long)ups_realpower, "W", - config.check_warn, (long)(config.warning_value), - config.check_crit, (long)(config.critical_value), - true, 0, false, 0)); + perfdata("realpower", (long)ups_realpower, "W", config.check_warn, (long)(config.warning_value), config.check_crit, (long)(config.critical_value), true, 0, + false, 0)); } else { - xasprintf(&data, "%s %s", data, - perfdata("realpower", (long)ups_realpower, "W", false, 0, - false, 0, true, 0, false, 0)); + xasprintf(&data, "%s %s", data, perfdata("realpower", (long)ups_realpower, "W", false, 0, false, 0, true, 0, false, 0)); } } @@ -425,8 +392,7 @@ int determine_status(ups_config *config, int *supported_options) { char temp_buffer[MAX_INPUT_BUFFER]; strcpy(temp_buffer, recv_buffer); - for (char *ptr = (char *)strtok(temp_buffer, " "); ptr != NULL; - ptr = (char *)strtok(NULL, " ")) { + for (char *ptr = (char *)strtok(temp_buffer, " "); ptr != NULL; ptr = (char *)strtok(NULL, " ")) { if (!strcmp(ptr, "OFF")) { config->status |= UPSSTATUS_OFF; } else if (!strcmp(ptr, "OL")) { @@ -467,8 +433,7 @@ int get_ups_variable(const char *varname, char *buf, const ups_config config) { /* create the command string to send to the UPS daemon */ /* Add LOGOUT to avoid read failure logs */ - int res = snprintf(send_buffer, sizeof(send_buffer), - "GET VAR %s %s\nLOGOUT\n", config.ups_name, varname); + int res = snprintf(send_buffer, sizeof(send_buffer), "GET VAR %s %s\nLOGOUT\n", config.ups_name, varname); if ((res > 0) && ((size_t)res >= sizeof(send_buffer))) { printf("%s\n", _("UPS name to long for buffer")); return ERROR; @@ -477,9 +442,7 @@ int get_ups_variable(const char *varname, char *buf, const ups_config config) { char temp_buffer[MAX_INPUT_BUFFER]; /* send the command to the daemon and get a response back */ - if (process_tcp_request(config.server_address, config.server_port, - send_buffer, temp_buffer, - sizeof(temp_buffer)) != STATE_OK) { + if (process_tcp_request(config.server_address, config.server_port, send_buffer, temp_buffer, sizeof(temp_buffer)) != STATE_OK) { printf("%s\n", _("Invalid response received from host")); return ERROR; } @@ -496,8 +459,7 @@ int get_ups_variable(const char *varname, char *buf, const ups_config config) { ptr[len - 1] = 0; } if (strcmp(ptr, "ERR UNKNOWN-UPS") == 0) { - printf(_("CRITICAL - no such UPS '%s' on that host\n"), - config.ups_name); + printf(_("CRITICAL - no such UPS '%s' on that host\n"), config.ups_name); return ERROR; } @@ -694,8 +656,7 @@ void print_help(void) { printf(" %s\n", "-T, --temperature"); printf(" %s\n", _("Output of temperatures in Celsius")); printf(" %s\n", "-v, --variable=STRING"); - printf(" %s %s\n", _("Valid values for STRING are"), - "LINE, TEMP, BATTPCT, LOADPCT or REALPOWER"); + printf(" %s %s\n", _("Valid values for STRING are"), "LINE, TEMP, BATTPCT, LOADPCT or REALPOWER"); printf(UT_WARN_CRIT); @@ -731,8 +692,7 @@ void print_help(void) { "with Russell Kroll's")); printf(" %s\n", _("Network UPS Tools be installed on the remote host. If " "you do not have the")); - printf(" %s\n", - _("package installed on your system, you can download it from")); + printf(" %s\n", _("package installed on your system, you can download it from")); printf(" %s\n", _("http://www.networkupstools.org")); printf(UT_SUPPORT); -- cgit v1.2.3-74-g34f1 From 3f7c533ce87c764ff5278e18cec84b06e221b1c5 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:26:21 +0200 Subject: check_ups: Update copyright --- plugins/check_ups.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 1d313298..e5badc83 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -6,7 +6,7 @@ * Copyright (c) 2000 Tom Shields * 2004 Alain Richard * 2004 Arnaud Quette - * Copyright (c) 2002-2023 Monitoring Plugins Development Team + * Copyright (c) 2002-2024 Monitoring Plugins Development Team * * Description: * @@ -33,7 +33,7 @@ *****************************************************************************/ const char *progname = "check_ups"; -const char *copyright = "2000-2023"; +const char *copyright = "2000-2024"; const char *email = "devel@monitoring-plugins.org"; #include "common.h" -- cgit v1.2.3-74-g34f1 From c0a3bd07057f7e6b000d477088424cf71f89e3e7 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sat, 19 Oct 2024 01:21:02 +0200 Subject: clang format config: line lenght 180 -> 140, no base style --- .clang-format | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.clang-format b/.clang-format index c7f0b5ed..a7d19499 100644 --- a/.clang-format +++ b/.clang-format @@ -1,10 +1,10 @@ -BasedOnStyle: LLVM UseTab: ForContinuationAndIndentation IndentWidth: 4 TabWidth: 4 AllowShortIfStatementsOnASingleLine: false BreakBeforeBraces: Attach AlignConsecutiveMacros: true -ColumnLimit: 180 +ColumnLimit: 140 IndentPPDirectives: AfterHash SortIncludes: Never +BinPackArguments: false -- cgit v1.2.3-74-g34f1 From 4541b2b3571fd7806313187aa852bfe7c2ad5235 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sat, 19 Oct 2024 01:21:22 +0200 Subject: check_ups: clang-format again --- plugins/check_ups.c | 144 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 105 insertions(+), 39 deletions(-) diff --git a/plugins/check_ups.c b/plugins/check_ups.c index e5badc83..c2451ab3 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -235,9 +235,19 @@ int main(int argc, char **argv) { } else if (config.check_warn && ups_utility_deviation >= config.warning_value) { result = max_state(result, STATE_WARNING); } - xasprintf(&data, "%s", - perfdata("voltage", (long)(1000 * ups_utility_voltage), "mV", config.check_warn, (long)(1000 * config.warning_value), config.check_crit, - (long)(1000 * config.critical_value), true, 0, false, 0)); + xasprintf(&data, + "%s", + perfdata("voltage", + (long)(1000 * ups_utility_voltage), + "mV", + config.check_warn, + (long)(1000 * config.warning_value), + config.check_crit, + (long)(1000 * config.critical_value), + true, + 0, + false, + 0)); } else { xasprintf(&data, "%s", perfdata("voltage", (long)(1000 * ups_utility_voltage), "mV", false, 0, false, 0, true, 0, false, 0)); } @@ -262,9 +272,20 @@ int main(int argc, char **argv) { } else if (config.check_warn && ups_battery_percent <= config.warning_value) { result = max_state(result, STATE_WARNING); } - xasprintf(&data, "%s %s", data, - perfdata("battery", (long)ups_battery_percent, "%", config.check_warn, (long)(config.warning_value), config.check_crit, (long)(config.critical_value), true, - 0, true, 100)); + xasprintf(&data, + "%s %s", + data, + perfdata("battery", + (long)ups_battery_percent, + "%", + config.check_warn, + (long)(config.warning_value), + config.check_crit, + (long)(config.critical_value), + true, + 0, + true, + 100)); } else { xasprintf(&data, "%s %s", data, perfdata("battery", (long)ups_battery_percent, "%", false, 0, false, 0, true, 0, true, 100)); } @@ -289,9 +310,20 @@ int main(int argc, char **argv) { } else if (config.check_warn && ups_load_percent >= config.warning_value) { result = max_state(result, STATE_WARNING); } - xasprintf(&data, "%s %s", data, - perfdata("load", (long)ups_load_percent, "%", config.check_warn, (long)(config.warning_value), config.check_crit, (long)(config.critical_value), true, 0, - true, 100)); + xasprintf(&data, + "%s %s", + data, + perfdata("load", + (long)ups_load_percent, + "%", + config.check_warn, + (long)(config.warning_value), + config.check_crit, + (long)(config.critical_value), + true, + 0, + true, + 100)); } else { xasprintf(&data, "%s %s", data, perfdata("load", (long)ups_load_percent, "%", false, 0, false, 0, true, 0, true, 100)); } @@ -325,9 +357,20 @@ int main(int argc, char **argv) { } else if (config.check_warn && ups_temperature >= config.warning_value) { result = max_state(result, STATE_WARNING); } - xasprintf(&data, "%s %s", data, - perfdata("temp", (long)ups_temperature, tunits, config.check_warn, (long)(config.warning_value), config.check_crit, (long)(config.critical_value), true, 0, - false, 0)); + xasprintf(&data, + "%s %s", + data, + perfdata("temp", + (long)ups_temperature, + tunits, + config.check_warn, + (long)(config.warning_value), + config.check_crit, + (long)(config.critical_value), + true, + 0, + false, + 0)); } else { xasprintf(&data, "%s %s", data, perfdata("temp", (long)ups_temperature, tunits, false, 0, false, 0, true, 0, false, 0)); } @@ -351,9 +394,20 @@ int main(int argc, char **argv) { } else if (config.check_warn && ups_realpower >= config.warning_value) { result = max_state(result, STATE_WARNING); } - xasprintf(&data, "%s %s", data, - perfdata("realpower", (long)ups_realpower, "W", config.check_warn, (long)(config.warning_value), config.check_crit, (long)(config.critical_value), true, 0, - false, 0)); + xasprintf(&data, + "%s %s", + data, + perfdata("realpower", + (long)ups_realpower, + "W", + config.check_warn, + (long)(config.warning_value), + config.check_crit, + (long)(config.critical_value), + true, + 0, + false, + 0)); } else { xasprintf(&data, "%s %s", data, perfdata("realpower", (long)ups_realpower, "W", false, 0, false, 0, true, 0, false, 0)); } @@ -635,10 +689,12 @@ void print_help(void) { printf("Copyright (c) 2004 Arnaud Quette \n"); printf(COPYRIGHT, copyright, email); - printf("%s\n", _("This plugin tests the UPS service on the specified host. " - "Network UPS Tools")); - printf("%s\n", _("from www.networkupstools.org must be running for this " - "plugin to work.")); + printf("%s\n", + _("This plugin tests the UPS service on the specified host. " + "Network UPS Tools")); + printf("%s\n", + _("from www.networkupstools.org must be running for this " + "plugin to work.")); printf("\n\n"); @@ -667,31 +723,41 @@ void print_help(void) { /* printf (UT_VERBOSE); */ printf("\n"); - printf("%s\n", _("This plugin attempts to determine the status of a UPS " - "(Uninterruptible Power")); - printf("%s\n", _("Supply) on a local or remote host. If the UPS is online " - "or calibrating, the")); - printf("%s\n", _("plugin will return an OK state. If the battery is on it " - "will return a WARNING")); - printf("%s\n", _("state. If the UPS is off or has a low battery the plugin " - "will return a CRITICAL")); + printf("%s\n", + _("This plugin attempts to determine the status of a UPS " + "(Uninterruptible Power")); + printf("%s\n", + _("Supply) on a local or remote host. If the UPS is online " + "or calibrating, the")); + printf("%s\n", + _("plugin will return an OK state. If the battery is on it " + "will return a WARNING")); + printf("%s\n", + _("state. If the UPS is off or has a low battery the plugin " + "will return a CRITICAL")); printf("%s\n", _("state.")); printf("\n"); printf("%s\n", _("Notes:")); - printf(" %s\n", _("You may also specify a variable to check (such as " - "temperature, utility voltage,")); - printf(" %s\n", _("battery load, etc.) as well as warning and critical " - "thresholds for the value")); - printf(" %s\n", _("of that variable. If the remote host has multiple UPS " - "that are being monitored")); - printf(" %s\n", _("you will have to use the --ups option to specify which " - "UPS to check.")); + printf(" %s\n", + _("You may also specify a variable to check (such as " + "temperature, utility voltage,")); + printf(" %s\n", + _("battery load, etc.) as well as warning and critical " + "thresholds for the value")); + printf(" %s\n", + _("of that variable. If the remote host has multiple UPS " + "that are being monitored")); + printf(" %s\n", + _("you will have to use the --ups option to specify which " + "UPS to check.")); printf("\n"); - printf(" %s\n", _("This plugin requires that the UPSD daemon distributed " - "with Russell Kroll's")); - printf(" %s\n", _("Network UPS Tools be installed on the remote host. If " - "you do not have the")); + printf(" %s\n", + _("This plugin requires that the UPSD daemon distributed " + "with Russell Kroll's")); + printf(" %s\n", + _("Network UPS Tools be installed on the remote host. If " + "you do not have the")); printf(" %s\n", _("package installed on your system, you can download it from")); printf(" %s\n", _("http://www.networkupstools.org")); -- cgit v1.2.3-74-g34f1 From 39705a8c1f7b8ecba29b1e3e5abb906d9c2e6b5b Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 25 Oct 2024 11:45:48 +0200 Subject: clang-format options: set BinPack to true --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index a7d19499..f29680a2 100644 --- a/.clang-format +++ b/.clang-format @@ -7,4 +7,4 @@ AlignConsecutiveMacros: true ColumnLimit: 140 IndentPPDirectives: AfterHash SortIncludes: Never -BinPackArguments: false +BinPackArguments: true -- cgit v1.2.3-74-g34f1 From 05ad606c09325ae9ae7d4607a55236245dcad47a Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 25 Oct 2024 11:45:58 +0200 Subject: check_ups: clang-format again --- plugins/check_ups.c | 144 ++++++++++++++-------------------------------------- 1 file changed, 39 insertions(+), 105 deletions(-) diff --git a/plugins/check_ups.c b/plugins/check_ups.c index c2451ab3..f60c0e9e 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -235,19 +235,9 @@ int main(int argc, char **argv) { } else if (config.check_warn && ups_utility_deviation >= config.warning_value) { result = max_state(result, STATE_WARNING); } - xasprintf(&data, - "%s", - perfdata("voltage", - (long)(1000 * ups_utility_voltage), - "mV", - config.check_warn, - (long)(1000 * config.warning_value), - config.check_crit, - (long)(1000 * config.critical_value), - true, - 0, - false, - 0)); + xasprintf(&data, "%s", + perfdata("voltage", (long)(1000 * ups_utility_voltage), "mV", config.check_warn, (long)(1000 * config.warning_value), + config.check_crit, (long)(1000 * config.critical_value), true, 0, false, 0)); } else { xasprintf(&data, "%s", perfdata("voltage", (long)(1000 * ups_utility_voltage), "mV", false, 0, false, 0, true, 0, false, 0)); } @@ -272,20 +262,9 @@ int main(int argc, char **argv) { } else if (config.check_warn && ups_battery_percent <= config.warning_value) { result = max_state(result, STATE_WARNING); } - xasprintf(&data, - "%s %s", - data, - perfdata("battery", - (long)ups_battery_percent, - "%", - config.check_warn, - (long)(config.warning_value), - config.check_crit, - (long)(config.critical_value), - true, - 0, - true, - 100)); + xasprintf(&data, "%s %s", data, + perfdata("battery", (long)ups_battery_percent, "%", config.check_warn, (long)(config.warning_value), + config.check_crit, (long)(config.critical_value), true, 0, true, 100)); } else { xasprintf(&data, "%s %s", data, perfdata("battery", (long)ups_battery_percent, "%", false, 0, false, 0, true, 0, true, 100)); } @@ -310,20 +289,9 @@ int main(int argc, char **argv) { } else if (config.check_warn && ups_load_percent >= config.warning_value) { result = max_state(result, STATE_WARNING); } - xasprintf(&data, - "%s %s", - data, - perfdata("load", - (long)ups_load_percent, - "%", - config.check_warn, - (long)(config.warning_value), - config.check_crit, - (long)(config.critical_value), - true, - 0, - true, - 100)); + xasprintf(&data, "%s %s", data, + perfdata("load", (long)ups_load_percent, "%", config.check_warn, (long)(config.warning_value), config.check_crit, + (long)(config.critical_value), true, 0, true, 100)); } else { xasprintf(&data, "%s %s", data, perfdata("load", (long)ups_load_percent, "%", false, 0, false, 0, true, 0, true, 100)); } @@ -357,20 +325,9 @@ int main(int argc, char **argv) { } else if (config.check_warn && ups_temperature >= config.warning_value) { result = max_state(result, STATE_WARNING); } - xasprintf(&data, - "%s %s", - data, - perfdata("temp", - (long)ups_temperature, - tunits, - config.check_warn, - (long)(config.warning_value), - config.check_crit, - (long)(config.critical_value), - true, - 0, - false, - 0)); + xasprintf(&data, "%s %s", data, + perfdata("temp", (long)ups_temperature, tunits, config.check_warn, (long)(config.warning_value), config.check_crit, + (long)(config.critical_value), true, 0, false, 0)); } else { xasprintf(&data, "%s %s", data, perfdata("temp", (long)ups_temperature, tunits, false, 0, false, 0, true, 0, false, 0)); } @@ -394,20 +351,9 @@ int main(int argc, char **argv) { } else if (config.check_warn && ups_realpower >= config.warning_value) { result = max_state(result, STATE_WARNING); } - xasprintf(&data, - "%s %s", - data, - perfdata("realpower", - (long)ups_realpower, - "W", - config.check_warn, - (long)(config.warning_value), - config.check_crit, - (long)(config.critical_value), - true, - 0, - false, - 0)); + xasprintf(&data, "%s %s", data, + perfdata("realpower", (long)ups_realpower, "W", config.check_warn, (long)(config.warning_value), config.check_crit, + (long)(config.critical_value), true, 0, false, 0)); } else { xasprintf(&data, "%s %s", data, perfdata("realpower", (long)ups_realpower, "W", false, 0, false, 0, true, 0, false, 0)); } @@ -689,12 +635,10 @@ void print_help(void) { printf("Copyright (c) 2004 Arnaud Quette \n"); printf(COPYRIGHT, copyright, email); - printf("%s\n", - _("This plugin tests the UPS service on the specified host. " - "Network UPS Tools")); - printf("%s\n", - _("from www.networkupstools.org must be running for this " - "plugin to work.")); + printf("%s\n", _("This plugin tests the UPS service on the specified host. " + "Network UPS Tools")); + printf("%s\n", _("from www.networkupstools.org must be running for this " + "plugin to work.")); printf("\n\n"); @@ -723,41 +667,31 @@ void print_help(void) { /* printf (UT_VERBOSE); */ printf("\n"); - printf("%s\n", - _("This plugin attempts to determine the status of a UPS " - "(Uninterruptible Power")); - printf("%s\n", - _("Supply) on a local or remote host. If the UPS is online " - "or calibrating, the")); - printf("%s\n", - _("plugin will return an OK state. If the battery is on it " - "will return a WARNING")); - printf("%s\n", - _("state. If the UPS is off or has a low battery the plugin " - "will return a CRITICAL")); + printf("%s\n", _("This plugin attempts to determine the status of a UPS " + "(Uninterruptible Power")); + printf("%s\n", _("Supply) on a local or remote host. If the UPS is online " + "or calibrating, the")); + printf("%s\n", _("plugin will return an OK state. If the battery is on it " + "will return a WARNING")); + printf("%s\n", _("state. If the UPS is off or has a low battery the plugin " + "will return a CRITICAL")); printf("%s\n", _("state.")); printf("\n"); printf("%s\n", _("Notes:")); - printf(" %s\n", - _("You may also specify a variable to check (such as " - "temperature, utility voltage,")); - printf(" %s\n", - _("battery load, etc.) as well as warning and critical " - "thresholds for the value")); - printf(" %s\n", - _("of that variable. If the remote host has multiple UPS " - "that are being monitored")); - printf(" %s\n", - _("you will have to use the --ups option to specify which " - "UPS to check.")); + printf(" %s\n", _("You may also specify a variable to check (such as " + "temperature, utility voltage,")); + printf(" %s\n", _("battery load, etc.) as well as warning and critical " + "thresholds for the value")); + printf(" %s\n", _("of that variable. If the remote host has multiple UPS " + "that are being monitored")); + printf(" %s\n", _("you will have to use the --ups option to specify which " + "UPS to check.")); printf("\n"); - printf(" %s\n", - _("This plugin requires that the UPSD daemon distributed " - "with Russell Kroll's")); - printf(" %s\n", - _("Network UPS Tools be installed on the remote host. If " - "you do not have the")); + printf(" %s\n", _("This plugin requires that the UPSD daemon distributed " + "with Russell Kroll's")); + printf(" %s\n", _("Network UPS Tools be installed on the remote host. If " + "you do not have the")); printf(" %s\n", _("package installed on your system, you can download it from")); printf(" %s\n", _("http://www.networkupstools.org")); -- cgit v1.2.3-74-g34f1