[monitoring-plugins] Clang format everything (#2353)
GitHub
git at monitoring-plugins.org
Tue Sep 29 09:10:14 CEST 2026
Module: monitoring-plugins
Branch: master
Commit: a2544a82815bda865e02f94d694ddc4780b40bf9
Author: Lorenz Kästle <12514511+RincewindsHat at users.noreply.github.com>
Committer: GitHub <noreply at github.com>
Date: Tue Sep 29 09:08:31 2026 +0200
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=a2544a82
Clang format everything (#2353)
* Add clang-format check
* clang-format everything
---------
Co-authored-by: Lorenz Kästle <lorenz.kaestle+gitub-mopl at mailbox.org>
---
.github/workflows/formatting.yml | 35 ++++++++++++
lib/output.c | 2 +-
lib/tests/test_generic_output.c | 11 ++--
lib/tests/test_utils.c | 10 +---
lib/utils_base.c | 2 -
lib/vendor/cJSON/cJSON.h | 2 +-
plugins-root/check_dhcp.c | 16 +++---
plugins-root/check_icmp.c | 32 ++++++-----
plugins/check_apt.c | 8 +--
plugins/check_by_ssh.c | 17 +++---
plugins/check_cluster.c | 9 +--
plugins/check_curl.c | 84 +++++++++++++++------------
plugins/check_curl.d/check_curl_helpers.c | 40 +++++++------
plugins/check_dbi.c | 49 +++++++++-------
plugins/check_dig.c | 17 +++---
plugins/check_disk.c | 28 +++++----
plugins/check_dns.c | 29 +++++-----
plugins/check_fping.c | 20 ++++---
plugins/check_game.c | 11 ++--
plugins/check_http.c | 94 +++++++++++++++++--------------
plugins/check_ldap.c | 48 +++++++++-------
plugins/check_load.c | 18 +++---
plugins/check_mrtg.c | 9 +--
plugins/check_mrtgtraf.c | 13 +++--
plugins/check_mysql.d/config.h | 4 +-
plugins/check_ntp_time.c | 3 +-
plugins/check_pgsql.c | 25 ++++----
plugins/check_procs.c | 48 ++++++++--------
plugins/check_real.c | 30 +++++-----
plugins/check_smtp.c | 51 ++++++++++-------
plugins/check_snmp.c | 26 +++++----
plugins/check_snmp.d/check_snmp_helpers.c | 46 +++++++++------
plugins/check_ssh.c | 26 +++++----
plugins/check_swap.c | 8 +--
plugins/check_tcp.c | 45 ++++++++-------
plugins/check_time.c | 13 +++--
plugins/check_ups.c | 57 ++++++++++++-------
plugins/check_users.c | 8 +--
plugins/negate.c | 27 +++++----
plugins/netutils.c | 6 +-
plugins/netutils.h | 8 ++-
plugins/sslutils.c | 23 +++++---
plugins/tests/test_check_snmp.c | 4 +-
plugins/utils.c | 10 ++--
plugins/utils.h | 11 ++--
45 files changed, 629 insertions(+), 454 deletions(-)
diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml
new file mode 100644
index 00000000..b4a3e93c
--- /dev/null
+++ b/.github/workflows/formatting.yml
@@ -0,0 +1,35 @@
+---
+name: Formatting
+
+on:
+ workflow_dispatch: {}
+ # Run for pushes on any branch
+ push:
+ branches:
+ - '*'
+ # Run for any PRs
+ pull_request:
+
+jobs:
+ clang-format:
+ name: clang-format
+ strategy:
+ fail-fast: false
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout at v7
+ - name: Run clang-format
+ run: |
+ docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol
+ docker run \
+ --privileged=true \
+ -w /src -v ${PWD}:/src \
+ debian:stable \
+ /bin/sh -c 'apt install -y clang-format --update > /dev/null && \
+ echo Checking .c files format && \
+ find . -path ./gl -prune , -path ./lib/vendor -prune , -path ./build-aux -prune , -iname '*.c' -exec clang-format -Werror --dry-run {} \+ && \
+ echo Checking .h files format && \
+ find . -path ./gl -prune , -path ./lib/vendor -prune , -path ./build-aux -prune , -iname '*.h' -exec clang-format -Werror --dry-run {} \+'
+ docker container prune -f
+ docker volume prune -f
diff --git a/lib/output.c b/lib/output.c
index b73460eb..c46a5906 100644
--- a/lib/output.c
+++ b/lib/output.c
@@ -496,7 +496,7 @@ static inline char *fmt_subcheck_output(mp_output_format output_format, mp_subch
if (have_residual_chars) {
char *tmp = check.output;
asprintf(&check.output, "%s%s%s", intermediate_string,
- generate_indentation_string(indentation + 1), tmp);
+ generate_indentation_string(indentation + 1), tmp);
} else {
check.output = intermediate_string;
}
diff --git a/lib/tests/test_generic_output.c b/lib/tests/test_generic_output.c
index 61bcf130..fee4cfdb 100644
--- a/lib/tests/test_generic_output.c
+++ b/lib/tests/test_generic_output.c
@@ -271,11 +271,12 @@ void test_deep_check_hierarchy2(void) {
ok(output != NULL, "Output should not be NULL");
- char expected[] = "[WARNING] - foobar\n"
- "\t\\_[WARNING] - foobar\n"
- "\t\t\\_[OK] - baz\n"
- "\t\t\t\\_[OK] - level3\n"
- "\t\t\t\t\\_[OK] - level4|'foo'=23s;;; 'baz'=1024B;;; 'floatMe'=1024.102400;;; ";
+ char expected[] =
+ "[WARNING] - foobar\n"
+ "\t\\_[WARNING] - foobar\n"
+ "\t\t\\_[OK] - baz\n"
+ "\t\t\t\\_[OK] - level3\n"
+ "\t\t\t\t\\_[OK] - level4|'foo'=23s;;; 'baz'=1024B;;; 'floatMe'=1024.102400;;; ";
// diag("Expected output of length: %i", strlen(expected));
// diag(expected);
diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c
index d3c5d237..2c427b5d 100644
--- a/lib/tests/test_utils.c
+++ b/lib/tests/test_utils.c
@@ -111,12 +111,9 @@ int main(int argc, char **argv) {
mp_range mp_range_test = mp_range_init();
mp_range_test = mp_range_set_end(mp_range_test, mp_create_pd_value(2));
- ok(mp_check_range(mp_create_pd_value(1), mp_range_test) == false,
- "mp range ~:2: 1 - no alert");
- ok(mp_check_range(mp_create_pd_value(2), mp_range_test) == false,
- "mp range ~:2: 2 - no alert");
- ok(mp_check_range(mp_create_pd_value(3), mp_range_test) == true,
- "mp range ~:2: 3 - alert");
+ ok(mp_check_range(mp_create_pd_value(1), mp_range_test) == false, "mp range ~:2: 1 - no alert");
+ ok(mp_check_range(mp_create_pd_value(2), mp_range_test) == false, "mp range ~:2: 2 - no alert");
+ ok(mp_check_range(mp_create_pd_value(3), mp_range_test) == true, "mp range ~:2: 3 - alert");
range = parse_range_string("@0:657.8210567");
ok(range != 0, "@0:657.8210567' is a valid range");
@@ -226,7 +223,6 @@ int main(int argc, char **argv) {
test = np_escaped_string("everything");
ok(strcmp(test, "everything") == 0, "everything okay");
-
ok(mp_suid() == false, "Test aren't suid");
/* base states with random case */
diff --git a/lib/utils_base.c b/lib/utils_base.c
index 98915f2a..e767548b 100644
--- a/lib/utils_base.c
+++ b/lib/utils_base.c
@@ -322,8 +322,6 @@ char *np_escaped_string(const char *string) {
int np_check_if_root(void) { return (geteuid() == 0); }
-
-
const char *state_text(mp_state_enum result) {
switch (result) {
case STATE_OK:
diff --git a/lib/vendor/cJSON/cJSON.h b/lib/vendor/cJSON/cJSON.h
index 37520bbc..3edf8bc4 100644
--- a/lib/vendor/cJSON/cJSON.h
+++ b/lib/vendor/cJSON/cJSON.h
@@ -261,7 +261,7 @@ CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive);
/* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings.
- * The input pointer json cannot point to a read-only address area, such as a string constant,
+ * The input pointer json cannot point to a read-only address area, such as a string constant,
* but should point to a readable and writable address area. */
CJSON_PUBLIC(void) cJSON_Minify(char *json);
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c
index 1fc1aff8..df10e9af 100644
--- a/plugins-root/check_dhcp.c
+++ b/plugins-root/check_dhcp.c
@@ -1133,7 +1133,7 @@ mp_subcheck get_results(bool exclusive, const int requested_servers,
mp_subcheck sc_rqust_srvs = mp_subcheck_init();
mopl_utils_xasprintf(&sc_rqust_srvs.output, "%d of %d requested servers responded",
- requested_responses, requested_servers);
+ requested_responses, requested_servers);
if (requested_responses == requested_servers) {
sc_rqust_srvs = mp_set_subcheck_state(sc_rqust_srvs, STATE_OK);
@@ -1167,10 +1167,11 @@ mp_subcheck get_results(bool exclusive, const int requested_servers,
}
if (max_lease_time == DHCP_INFINITE_TIME) {
- mopl_utils_xasprintf(&sc_dhcp_results.output, "%s, max lease time = Infinity", sc_dhcp_results.output);
+ mopl_utils_xasprintf(&sc_dhcp_results.output, "%s, max lease time = Infinity",
+ sc_dhcp_results.output);
} else {
mopl_utils_xasprintf(&sc_dhcp_results.output, "%s, max lease time = %" PRIu32 " seconds",
- sc_dhcp_results.output, max_lease_time);
+ sc_dhcp_results.output, max_lease_time);
}
if (exclusive) {
@@ -1201,8 +1202,9 @@ mp_subcheck get_results(bool exclusive, const int requested_servers,
die(STATE_UNKNOWN, "inet_ntop failed");
}
- mopl_utils_xasprintf(&sc_rogue_server.output, "Rogue DHCP Server detected! Server %s offered %s",
- server_address, offered_address);
+ mopl_utils_xasprintf(&sc_rogue_server.output,
+ "Rogue DHCP Server detected! Server %s offered %s", server_address,
+ offered_address);
} else {
sc_rogue_server = mp_set_subcheck_state(sc_rogue_server, STATE_OK);
mopl_utils_xasprintf(&sc_rogue_server.output, "No Rogue DHCP Server detected");
@@ -1216,11 +1218,11 @@ mp_subcheck get_results(bool exclusive, const int requested_servers,
if (received_requested_address) {
sc_rqustd_addr = mp_set_subcheck_state(sc_rqustd_addr, STATE_OK);
mopl_utils_xasprintf(&sc_rqustd_addr.output, "Requested address (%s) was offered",
- inet_ntoa(requested_address));
+ inet_ntoa(requested_address));
} else {
sc_rqustd_addr = mp_set_subcheck_state(sc_rqustd_addr, STATE_WARNING);
mopl_utils_xasprintf(&sc_rqustd_addr.output, "Requested address (%s) was NOT offered",
- inet_ntoa(requested_address));
+ inet_ntoa(requested_address));
}
mp_add_subcheck_to_subcheck(&sc_dhcp_results, sc_rqustd_addr);
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index eafae267..af65bc41 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -412,8 +412,8 @@ check_icmp_config_wrapper process_arguments(int argc, char **argv) {
result.config.icmp_data_size = (unsigned short)size;
} else {
mopl_utils_usage_va("ICMP data length must be between: %lu and %lu",
- sizeof(struct icmp) + sizeof(struct icmp_ping_data),
- MAX_PING_DATA - 1);
+ sizeof(struct icmp) + sizeof(struct icmp_ping_data),
+ MAX_PING_DATA - 1);
}
} break;
case 'i': {
@@ -911,7 +911,8 @@ int main(int argc, char **argv) {
}
#endif // SO_TIMESTAMP
- if (setsockopt(sockset.socket6, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &config.ttl, sizeof(config.ttl))) {
+ if (setsockopt(sockset.socket6, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &config.ttl,
+ sizeof(config.ttl))) {
crash("setsockopt IPV6_UNICAST_HOPS");
} else if (debug) {
printf("hop limit set to %d\n", config.ttl);
@@ -1548,20 +1549,22 @@ static void finish(int sig, check_icmp_mode_switches modes, int min_hosts_alive,
if (targets_ok >= min_hosts_alive) {
sc_min_targets_alive = mp_set_subcheck_state(sc_min_targets_alive, STATE_OK);
- mopl_utils_xasprintf(&sc_min_targets_alive.output, "%u targets OK of a minimum of %u", targets_ok,
- min_hosts_alive);
+ mopl_utils_xasprintf(&sc_min_targets_alive.output, "%u targets OK of a minimum of %u",
+ targets_ok, min_hosts_alive);
// Overwrite main state here
overall->evaluation_function = &mp_eval_ok;
} else if ((targets_ok + targets_warn) >= min_hosts_alive) {
sc_min_targets_alive = mp_set_subcheck_state(sc_min_targets_alive, STATE_WARNING);
- mopl_utils_xasprintf(&sc_min_targets_alive.output, "%u targets OK or Warning of a minimum of %u",
- targets_ok + targets_warn, min_hosts_alive);
+ mopl_utils_xasprintf(&sc_min_targets_alive.output,
+ "%u targets OK or Warning of a minimum of %u",
+ targets_ok + targets_warn, min_hosts_alive);
overall->evaluation_function = &mp_eval_warning;
} else {
sc_min_targets_alive = mp_set_subcheck_state(sc_min_targets_alive, STATE_CRITICAL);
- mopl_utils_xasprintf(&sc_min_targets_alive.output, "%u targets OK or Warning of a minimum of %u",
- targets_ok + targets_warn, min_hosts_alive);
+ mopl_utils_xasprintf(&sc_min_targets_alive.output,
+ "%u targets OK or Warning of a minimum of %u",
+ targets_ok + targets_warn, min_hosts_alive);
overall->evaluation_function = &mp_eval_critical;
}
@@ -2224,7 +2227,7 @@ mp_subcheck evaluate_target(ping_target target, check_icmp_mode_switches modes,
if (target.flags & FLAG_LOST_CAUSE) {
mopl_utils_xasprintf(&result.output, "%s: %s @ %s", result.output,
- get_icmp_error_msg(target.icmp_type, target.icmp_code), address);
+ get_icmp_error_msg(target.icmp_type, target.icmp_code), address);
} else { /* not marked as lost cause, so we have no flags for it */
mopl_utils_xasprintf(&result.output, "%s", result.output);
}
@@ -2296,10 +2299,12 @@ mp_subcheck evaluate_target(ping_target target, check_icmp_mode_switches modes,
if (rta >= crit.rta) {
sc_rta = mp_set_subcheck_state(sc_rta, STATE_CRITICAL);
- mopl_utils_xasprintf(&sc_rta.output, "%s >= %0.3fms", sc_rta.output, (double)crit.rta / 1000);
+ mopl_utils_xasprintf(&sc_rta.output, "%s >= %0.3fms", sc_rta.output,
+ (double)crit.rta / 1000);
} else if (rta >= warn.rta) {
sc_rta = mp_set_subcheck_state(sc_rta, STATE_WARNING);
- mopl_utils_xasprintf(&sc_rta.output, "%s >= %0.3fms", sc_rta.output, (double)warn.rta / 1000);
+ mopl_utils_xasprintf(&sc_rta.output, "%s >= %0.3fms", sc_rta.output,
+ (double)warn.rta / 1000);
}
if (packet_loss < 100) {
@@ -2446,7 +2451,8 @@ mp_subcheck evaluate_target(ping_target target, check_icmp_mode_switches modes,
} else {
// score mode disabled due to not enough received packages
- mopl_utils_xasprintf(&sc_score.output, "Score mode disabled, not enough packets received");
+ mopl_utils_xasprintf(&sc_score.output,
+ "Score mode disabled, not enough packets received");
}
mp_add_subcheck_to_subcheck(&result, sc_score);
diff --git a/plugins/check_apt.c b/plugins/check_apt.c
index a6adf18c..7e1c245a 100644
--- a/plugins/check_apt.c
+++ b/plugins/check_apt.c
@@ -161,7 +161,7 @@ int main(int argc, char **argv) {
mp_subcheck sc_security_updates = mp_subcheck_init();
mopl_utils_xasprintf(&sc_security_updates.output, "Security updates available: %zu",
- number_of_security_updates);
+ number_of_security_updates);
mp_add_perfdata_to_subcheck(&sc_security_updates, pd_security_updates);
if (number_of_security_updates > 0) {
@@ -190,14 +190,14 @@ int main(int argc, char **argv) {
cmpstringp);
for (size_t i = 0; i < number_of_security_updates; i++) {
- mopl_utils_xasprintf(&sc_security_updates.output, "%s\n%s (security)", sc_security_updates.output,
- secpackages_list[i]);
+ mopl_utils_xasprintf(&sc_security_updates.output, "%s\n%s (security)",
+ sc_security_updates.output, secpackages_list[i]);
}
if (!config.only_critical) {
for (size_t i = 0; i < packages_available - number_of_security_updates; i++) {
mopl_utils_xasprintf(&sc_other_updates.output, "%s\n%s", sc_other_updates.output,
- packages_list[i]);
+ packages_list[i]);
}
}
}
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index c56b5a6f..e4e8fc71 100644
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.c
@@ -100,7 +100,8 @@ int main(int argc, char **argv) {
if (child_result.cmd_error_code == 255 && config.unknown_timeout) {
mp_subcheck sc_ssh_execution = mp_subcheck_init();
mopl_utils_xasprintf(&sc_ssh_execution.output, "SSH connection failed: %s",
- child_result.err.lines > 0 ? child_result.err.line[0] : "(no error output)");
+ child_result.err.lines > 0 ? child_result.err.line[0]
+ : "(no error output)");
sc_ssh_execution = mp_set_subcheck_state(sc_ssh_execution, STATE_UNKNOWN);
mp_add_subcheck_to_check(&overall, sc_ssh_execution);
@@ -135,7 +136,7 @@ int main(int argc, char **argv) {
(config.unknown_on_stderr || config.warn_on_stderr)) {
mp_subcheck sc_stderr = mp_subcheck_init();
mopl_utils_xasprintf(&sc_stderr.output, "remote command execution failed: %s",
- child_result.err.line[skip_stderr]);
+ child_result.err.line[skip_stderr]);
if (config.unknown_on_stderr) {
sc_stderr = mp_set_subcheck_state(sc_stderr, STATE_UNKNOWN);
@@ -164,7 +165,7 @@ int main(int argc, char **argv) {
mopl_utils_xasprintf(&remote_command_output, "%s", child_result.out.line[i]);
} else {
mopl_utils_xasprintf(&remote_command_output, "%s\n%s", remote_command_output,
- child_result.out.line[i]);
+ child_result.out.line[i]);
}
}
@@ -173,7 +174,7 @@ int main(int argc, char **argv) {
overall.default_output_override = check_by_ssh_output_override;
} else {
mopl_utils_xasprintf(&sc_active_check.output, "remote command '%s' returned status %d",
- config.remotecmd, child_result.cmd_error_code);
+ config.remotecmd, child_result.cmd_error_code);
}
/* return error status from remote command */
@@ -397,7 +398,7 @@ check_by_ssh_config_wrapper process_arguments(int argc, char **argv) {
result.config.commands++;
if (result.config.commands > 1) {
mopl_utils_xasprintf(&result.config.remotecmd, "%s;echo STATUS CODE: $?;",
- result.config.remotecmd);
+ result.config.remotecmd);
}
mopl_utils_xasprintf(&result.config.remotecmd, "%s%s", result.config.remotecmd, optarg);
break;
@@ -471,7 +472,8 @@ check_by_ssh_config_wrapper process_arguments(int argc, char **argv) {
if (strlen(result.config.remotecmd) == 0) {
for (; c < argc; c++) {
if (strlen(result.config.remotecmd) > 0) {
- mopl_utils_xasprintf(&result.config.remotecmd, "%s %s", result.config.remotecmd, argv[c]);
+ mopl_utils_xasprintf(&result.config.remotecmd, "%s %s", result.config.remotecmd,
+ argv[c]);
} else {
mopl_utils_xasprintf(&result.config.remotecmd, "%s", argv[c]);
}
@@ -479,7 +481,8 @@ check_by_ssh_config_wrapper process_arguments(int argc, char **argv) {
}
if (result.config.commands > 1 || result.config.passive) {
- mopl_utils_xasprintf(&result.config.remotecmd, "%s;echo STATUS CODE: $?;", result.config.remotecmd);
+ mopl_utils_xasprintf(&result.config.remotecmd, "%s;echo STATUS CODE: $?;",
+ result.config.remotecmd);
}
if (result.config.remotecmd == NULL || strlen(result.config.remotecmd) <= 1) {
diff --git a/plugins/check_cluster.c b/plugins/check_cluster.c
index bf7c453e..8943cad0 100644
--- a/plugins/check_cluster.c
+++ b/plugins/check_cluster.c
@@ -125,15 +125,16 @@ int main(int argc, char **argv) {
get_status(total_services_warning + total_services_unknown + total_services_critical,
config.thresholds));
mopl_utils_xasprintf(&sc_real_test.output, "%s: %d ok, %d warning, %d unknown, %d critical",
- (config.label == NULL) ? "Service cluster" : config.label, total_services_ok,
- total_services_warning, total_services_unknown, total_services_critical);
+ (config.label == NULL) ? "Service cluster" : config.label,
+ total_services_ok, total_services_warning, total_services_unknown,
+ total_services_critical);
} else {
sc_real_test = mp_set_subcheck_state(
sc_real_test,
get_status(total_hosts_down + total_hosts_unreachable, config.thresholds));
mopl_utils_xasprintf(&sc_real_test.output, "%s: %d up, %d down, %d unreachable\n",
- (config.label == NULL) ? "Host cluster" : config.label, total_hosts_up,
- total_hosts_down, total_hosts_unreachable);
+ (config.label == NULL) ? "Host cluster" : config.label, total_hosts_up,
+ total_hosts_down, total_hosts_unreachable);
}
mp_add_subcheck_to_check(&overall, sc_real_test);
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index fcc49030..2607fce1 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -278,12 +278,12 @@ mp_subcheck check_http(const check_curl_config config, check_curl_working_state
/* Custom handling for timeouts, state might be set to non CRITICAL */
if (res == CURLE_OPERATION_TIMEDOUT) {
mopl_utils_xasprintf(&sc_curl.output, _("cURL returned %d - %s"), res,
- errbuf[0] ? errbuf : curl_easy_strerror(res));
+ errbuf[0] ? errbuf : curl_easy_strerror(res));
sc_curl = mp_set_subcheck_state(sc_curl, config.on_timeout_result_state);
} else {
mopl_utils_xasprintf(&sc_curl.output,
- _("Error while performing connection: cURL returned %d - %s"), res,
- errbuf[0] ? errbuf : curl_easy_strerror(res));
+ _("Error while performing connection: cURL returned %d - %s"), res,
+ errbuf[0] ? errbuf : curl_easy_strerror(res));
sc_curl = mp_set_subcheck_state(sc_curl, STATE_CRITICAL);
}
mp_add_subcheck_to_subcheck(&sc_result, sc_curl);
@@ -437,17 +437,18 @@ mp_subcheck check_http(const check_curl_config config, check_curl_working_state
sc_expect = mp_set_subcheck_default_state(sc_expect, STATE_OK);
if (!expected_statuscode(curl_state.status_line->first_line, config.server_expect.string)) {
if (workingState.serverPort == HTTP_PORT) {
- mopl_utils_xasprintf(&sc_expect.output, _("Invalid HTTP response received from host: %s\n"),
- curl_state.status_line->first_line);
+ mopl_utils_xasprintf(&sc_expect.output,
+ _("Invalid HTTP response received from host: %s\n"),
+ curl_state.status_line->first_line);
} else {
mopl_utils_xasprintf(&sc_expect.output,
- _("Invalid HTTP response received from host on port %d: %s\n"),
- workingState.serverPort, curl_state.status_line->first_line);
+ _("Invalid HTTP response received from host on port %d: %s\n"),
+ workingState.serverPort, curl_state.status_line->first_line);
}
sc_expect = mp_set_subcheck_default_state(sc_expect, STATE_CRITICAL);
} else {
mopl_utils_xasprintf(&sc_expect.output, _("Status line output matched \"%s\""),
- config.server_expect.string);
+ config.server_expect.string);
}
mp_add_subcheck_to_subcheck(&sc_result, sc_expect);
@@ -456,12 +457,12 @@ mp_subcheck check_http(const check_curl_config config, check_curl_working_state
mp_subcheck sc_return_code = mp_subcheck_init();
sc_return_code = mp_set_subcheck_default_state(sc_return_code, STATE_OK);
mopl_utils_xasprintf(&sc_return_code.output, "HTTP return code: %d",
- curl_state.status_line->http_code);
+ curl_state.status_line->http_code);
if (httpReturnCode >= 600 || httpReturnCode < 100) {
sc_return_code = mp_set_subcheck_state(sc_return_code, STATE_CRITICAL);
mopl_utils_xasprintf(&sc_return_code.output, _("Invalid Status (%d, %.40s)"),
- curl_state.status_line->http_code, curl_state.status_line->msg);
+ curl_state.status_line->http_code, curl_state.status_line->msg);
mp_add_subcheck_to_subcheck(&sc_result, sc_return_code);
return sc_result;
}
@@ -488,14 +489,15 @@ mp_subcheck check_http(const check_curl_config config, check_curl_working_state
mp_subcheck sc_redir_depth = mp_subcheck_init();
if (redir_depth > config.max_depth) {
mopl_utils_xasprintf(&sc_redir_depth.output,
- "maximum redirection depth %ld exceeded in libcurl",
- config.max_depth);
+ "maximum redirection depth %ld exceeded in libcurl",
+ config.max_depth);
sc_redir_depth = mp_set_subcheck_state(sc_redir_depth, STATE_CRITICAL);
mp_add_subcheck_to_subcheck(&sc_result, sc_redir_depth);
return sc_result;
}
- mopl_utils_xasprintf(&sc_redir_depth.output, "redirection depth %ld (of a maximum %ld)",
- redir_depth, config.max_depth);
+ mopl_utils_xasprintf(&sc_redir_depth.output,
+ "redirection depth %ld (of a maximum %ld)", redir_depth,
+ config.max_depth);
mp_add_subcheck_to_subcheck(&sc_result, sc_redir_depth);
} else {
@@ -532,10 +534,11 @@ mp_subcheck check_http(const check_curl_config config, check_curl_working_state
sc_http_return_code_sanity =
mp_set_subcheck_state(sc_http_return_code_sanity, STATE_CRITICAL);
mopl_utils_xasprintf(&sc_http_return_code_sanity.output,
- _("HTTP CRITICAL %s %d %s - different HTTP codes (cUrl has %ld)\n"),
- string_statuscode(curl_state.status_line->http_major,
- curl_state.status_line->http_minor),
- curl_state.status_line->http_code, curl_state.status_line->msg, httpReturnCode);
+ _("HTTP CRITICAL %s %d %s - different HTTP codes (cUrl has %ld)\n"),
+ string_statuscode(curl_state.status_line->http_major,
+ curl_state.status_line->http_minor),
+ curl_state.status_line->http_code, curl_state.status_line->msg,
+ httpReturnCode);
mp_add_subcheck_to_subcheck(&sc_result, sc_http_return_code_sanity);
return sc_result;
@@ -560,10 +563,11 @@ mp_subcheck check_http(const check_curl_config config, check_curl_working_state
bcopy("...", &output_header_search[sizeof(output_header_search) - 4], 4);
}
- mopl_utils_xasprintf(&sc_header_expect.output, _("header '%s' not found on '%s://%s:%d%s', "),
- output_header_search, workingState.use_ssl ? "https" : "http",
- workingState.host_name ? workingState.host_name : workingState.server_address,
- workingState.serverPort, workingState.server_url);
+ mopl_utils_xasprintf(
+ &sc_header_expect.output, _("header '%s' not found on '%s://%s:%d%s', "),
+ output_header_search, workingState.use_ssl ? "https" : "http",
+ workingState.host_name ? workingState.host_name : workingState.server_address,
+ workingState.serverPort, workingState.server_url);
sc_header_expect = mp_set_subcheck_state(sc_header_expect, STATE_CRITICAL);
}
@@ -574,7 +578,8 @@ mp_subcheck check_http(const check_curl_config config, check_curl_working_state
if (strlen(config.string_expect)) {
mp_subcheck sc_string_expect = mp_subcheck_init();
sc_string_expect = mp_set_subcheck_default_state(sc_string_expect, STATE_OK);
- mopl_utils_xasprintf(&sc_string_expect.output, "Expect string \"%s\" in body", config.string_expect);
+ mopl_utils_xasprintf(&sc_string_expect.output, "Expect string \"%s\" in body",
+ config.string_expect);
if (!strstr(curl_state.body_buf->buf, config.string_expect)) {
char output_string_search[30] = "";
@@ -584,10 +589,11 @@ mp_subcheck check_http(const check_curl_config config, check_curl_working_state
bcopy("...", &output_string_search[sizeof(output_string_search) - 4], 4);
}
- mopl_utils_xasprintf(&sc_string_expect.output, _("string '%s' not found on '%s://%s:%d%s', "),
- output_string_search, workingState.use_ssl ? "https" : "http",
- workingState.host_name ? workingState.host_name : workingState.server_address,
- workingState.serverPort, workingState.server_url);
+ mopl_utils_xasprintf(
+ &sc_string_expect.output, _("string '%s' not found on '%s://%s:%d%s', "),
+ output_string_search, workingState.use_ssl ? "https" : "http",
+ workingState.host_name ? workingState.host_name : workingState.server_address,
+ workingState.serverPort, workingState.server_url);
sc_string_expect = mp_set_subcheck_state(sc_string_expect, STATE_CRITICAL);
}
@@ -657,7 +663,8 @@ mp_subcheck check_http(const check_curl_config config, check_curl_working_state
switch (tmp_state) {
case STATE_CRITICAL:
case STATE_WARNING:
- mopl_utils_xasprintf(&sc_page_length.output, _("page size %zu violates threshold"), page_len);
+ mopl_utils_xasprintf(&sc_page_length.output, _("page size %zu violates threshold"),
+ page_len);
break;
case STATE_OK:
mopl_utils_xasprintf(&sc_page_length.output, _("page size %zu is OK"), page_len);
@@ -1068,9 +1075,10 @@ check_curl_config_wrapper process_arguments(int argc, char **argv) {
} else if (!strcmp(optarg, "3") || !strcasecmp(optarg, "unknown")) {
result.config.on_timeout_result_state = STATE_UNKNOWN;
} else {
- mopl_utils_usage2(_("Invalid timeout-result state option, give either a return code or state "
- "name in lowercase"),
- optarg);
+ mopl_utils_usage2(
+ _("Invalid timeout-result state option, give either a return code or state "
+ "name in lowercase"),
+ optarg);
}
break;
case 'c': /* critical time threshold */
@@ -1122,10 +1130,12 @@ check_curl_config_wrapper process_arguments(int argc, char **argv) {
break;
case 'p': /* Server port */
if (!mopl_utils_is_intnonneg(optarg)) {
- mopl_utils_usage2(_("Invalid port number, expecting a non-negative number"), optarg);
+ mopl_utils_usage2(_("Invalid port number, expecting a non-negative number"),
+ optarg);
} else {
if (strtol(optarg, NULL, 10) > MAX_PORT) {
- mopl_utils_usage2(_("Invalid port number, supplied port number is too big"), optarg);
+ mopl_utils_usage2(_("Invalid port number, supplied port number is too big"),
+ optarg);
}
result.config.initial_config.serverPort = (unsigned short)strtol(optarg, NULL, 10);
specify_port = true;
@@ -1500,8 +1510,9 @@ check_curl_config_wrapper process_arguments(int argc, char **argv) {
result.config.ssl_version = CURL_SSLVERSION_DEFAULT;
#endif /* LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 52, 0) */
} else {
- mopl_utils_usage4(_("Invalid option - Valid SSL/TLS versions: 2, 3, 1, 1.1, 1.2, 1.3 "
- "(with optional '+' suffix)"));
+ mopl_utils_usage4(
+ _("Invalid option - Valid SSL/TLS versions: 2, 3, 1, 1.1, 1.2, 1.3 "
+ "(with optional '+' suffix)"));
}
}
#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 54, 0)
@@ -1565,7 +1576,8 @@ check_curl_config_wrapper process_arguments(int argc, char **argv) {
}
if (result.config.curl_config.client_cert && !result.config.curl_config.client_privkey) {
- mopl_utils_usage4(_("If you use a client certificate you must also specify a private key file"));
+ mopl_utils_usage4(
+ _("If you use a client certificate you must also specify a private key file"));
}
if (result.config.initial_config.virtualPort == 0) {
diff --git a/plugins/check_curl.d/check_curl_helpers.c b/plugins/check_curl.d/check_curl_helpers.c
index cbf12646..c60363af 100644
--- a/plugins/check_curl.d/check_curl_helpers.c
+++ b/plugins/check_curl.d/check_curl_helpers.c
@@ -890,37 +890,39 @@ mp_subcheck check_document_dates(const curlhelp_write_curlbuf *header_buf, const
if (srv_data <= 0) {
mopl_utils_xasprintf(&sc_document_dates.output, _("Server date \"%100s\" unparsable"),
- server_date);
+ server_date);
sc_document_dates = mp_set_subcheck_state(sc_document_dates, STATE_CRITICAL);
} else if (doc_data <= 0) {
mopl_utils_xasprintf(&sc_document_dates.output, _("Document date \"%100s\" unparsable"),
- document_date);
+ document_date);
sc_document_dates = mp_set_subcheck_state(sc_document_dates, STATE_CRITICAL);
} else if (doc_data > srv_data + 30) {
- mopl_utils_xasprintf(&sc_document_dates.output, _("Document is %d seconds in the future"),
- (int)doc_data - (int)srv_data);
+ mopl_utils_xasprintf(&sc_document_dates.output,
+ _("Document is %d seconds in the future"),
+ (int)doc_data - (int)srv_data);
sc_document_dates = mp_set_subcheck_state(sc_document_dates, STATE_CRITICAL);
} else if (doc_data < srv_data - maximum_age) {
time_t last_modified = (srv_data - doc_data);
if (last_modified > (60 * 60 * 24 * 2)) { // two days hardcoded?
mopl_utils_xasprintf(&sc_document_dates.output, _("Last modified %.1f days ago"),
- ((float)last_modified) / (60 * 60 * 24));
+ ((float)last_modified) / (60 * 60 * 24));
sc_document_dates = mp_set_subcheck_state(sc_document_dates, STATE_CRITICAL);
} else {
- mopl_utils_xasprintf(&sc_document_dates.output, _("Last modified %lld:%02d:%02d ago"),
- (long long)last_modified / (60 * 60), (int)(last_modified / 60) % 60,
- (int)last_modified % 60);
+ mopl_utils_xasprintf(&sc_document_dates.output,
+ _("Last modified %lld:%02d:%02d ago"),
+ (long long)last_modified / (60 * 60),
+ (int)(last_modified / 60) % 60, (int)last_modified % 60);
sc_document_dates = mp_set_subcheck_state(sc_document_dates, STATE_CRITICAL);
}
} else {
// TODO is this the OK case?
time_t last_modified = (srv_data - doc_data);
mopl_utils_xasprintf(&sc_document_dates.output, _("Last modified %lld:%02d:%02d ago"),
- (long long)last_modified / (60 * 60), (int)(last_modified / 60) % 60,
- (int)last_modified % 60);
+ (long long)last_modified / (60 * 60),
+ (int)(last_modified / 60) % 60, (int)last_modified % 60);
sc_document_dates = mp_set_subcheck_state(sc_document_dates, STATE_OK);
}
}
@@ -1319,8 +1321,9 @@ mp_subcheck check_curl_certificate_checks(CURL *curl, X509 *cert, int warn_days_
*/
return mp_net_ssl_check_certificate(cert, warn_days_till_exp, crit_days_till_exp);
# else /* MOPL_USE_OPENSSL */
- mopl_utils_xasprintf(&result.output, "HTTP CRITICAL - Cannot retrieve certificates - OpenSSL "
- "callback used and not linked against OpenSSL\n");
+ mopl_utils_xasprintf(&result.output,
+ "HTTP CRITICAL - Cannot retrieve certificates - OpenSSL "
+ "callback used and not linked against OpenSSL\n");
mp_set_subcheck_state(result, STATE_CRITICAL);
# endif /* MOPL_USE_OPENSSL */
} else {
@@ -1357,8 +1360,8 @@ mp_subcheck check_curl_certificate_checks(CURL *curl, X509 *cert, int warn_days_
if (!raw_cert) {
mopl_utils_xasprintf(&sc_cert_result.output,
- _("Cannot retrieve certificates from CERTINFO information - "
- "certificate data was empty"));
+ _("Cannot retrieve certificates from CERTINFO information - "
+ "certificate data was empty"));
sc_cert_result = mp_set_subcheck_state(sc_cert_result, STATE_CRITICAL);
return sc_cert_result;
}
@@ -1368,8 +1371,9 @@ mp_subcheck check_curl_certificate_checks(CURL *curl, X509 *cert, int warn_days_
cert = PEM_read_bio_X509(cert_BIO, NULL, NULL, NULL);
if (!cert) {
- mopl_utils_xasprintf(&sc_cert_result.output,
- _("Cannot read certificate from CERTINFO information - BIO error"));
+ mopl_utils_xasprintf(
+ &sc_cert_result.output,
+ _("Cannot read certificate from CERTINFO information - BIO error"));
sc_cert_result = mp_set_subcheck_state(sc_cert_result, STATE_CRITICAL);
return sc_cert_result;
}
@@ -1385,8 +1389,8 @@ mp_subcheck check_curl_certificate_checks(CURL *curl, X509 *cert, int warn_days_
# endif /* MOPL_USE_OPENSSL */
} else {
mopl_utils_xasprintf(&sc_cert_result.output,
- _("Cannot retrieve certificates - cURL returned %d - %s"), res,
- curl_easy_strerror(res));
+ _("Cannot retrieve certificates - cURL returned %d - %s"), res,
+ curl_easy_strerror(res));
mp_set_subcheck_state(sc_cert_result, STATE_CRITICAL);
}
}
diff --git a/plugins/check_dbi.c b/plugins/check_dbi.c
index f5165243..a309bd45 100644
--- a/plugins/check_dbi.c
+++ b/plugins/check_dbi.c
@@ -236,7 +236,7 @@ int main(int argc, char **argv) {
sc_connection_time = mp_set_subcheck_state(sc_connection_time, status);
if (status != STATE_OK) {
mopl_utils_xasprintf(&sc_connection_time.output, "%s violates thresholds",
- sc_connection_time.output);
+ sc_connection_time.output);
}
}
@@ -250,7 +250,8 @@ int main(int argc, char **argv) {
mp_subcheck sc_server_version = mp_subcheck_init();
sc_server_version = mp_set_subcheck_default_state(sc_server_version, STATE_OK);
- mopl_utils_xasprintf(&sc_server_version.output, "Connected to server version %u", server_version);
+ mopl_utils_xasprintf(&sc_server_version.output, "Connected to server version %u",
+ server_version);
if (config.metric == METRIC_SERVER_VERSION) {
mp_perfdata pd_server_version = perfdata_init();
@@ -263,7 +264,7 @@ int main(int argc, char **argv) {
if (status != STATE_OK) {
mopl_utils_xasprintf(&sc_server_version.output, "%s violates thresholds",
- sc_server_version.output);
+ sc_server_version.output);
}
};
mp_add_subcheck_to_check(&overall, sc_server_version);
@@ -298,7 +299,8 @@ int main(int argc, char **argv) {
sc_query = mp_set_subcheck_state(sc_query, STATE_CRITICAL);
} else if (query_res.query_processing_status != STATE_OK) {
if (query_res.error_string) {
- mopl_utils_xasprintf(&sc_query.output, "Failed to process query: %s", query_res.error_string);
+ mopl_utils_xasprintf(&sc_query.output, "Failed to process query: %s",
+ query_res.error_string);
} else {
mopl_utils_xasprintf(&sc_query.output, "Failed to process query");
}
@@ -325,11 +327,12 @@ int main(int argc, char **argv) {
if ((!query_res.result_string) ||
strcmp(query_res.result_string, config.expect)) {
mopl_utils_xasprintf(&sc_query.output, "Found string '%s' in query result",
- config.expect);
+ config.expect);
sc_query = mp_set_subcheck_state(sc_query, STATE_CRITICAL);
} else {
- mopl_utils_xasprintf(&sc_query.output, "Did not find string '%s' in query result",
- config.expect);
+ mopl_utils_xasprintf(&sc_query.output,
+ "Did not find string '%s' in query result",
+ config.expect);
sc_query = mp_set_subcheck_state(sc_query, STATE_OK);
}
} else if (config.expect_re_str) {
@@ -347,18 +350,20 @@ int main(int argc, char **argv) {
regexec(&expect_re, query_res.result_string, 0, NULL, /* flags = */ 0);
if (!err) {
sc_query = mp_set_subcheck_state(sc_query, STATE_OK);
- mopl_utils_xasprintf(&sc_query.output, "Found regular expression '%s' in query result",
- config.expect_re_str);
+ mopl_utils_xasprintf(&sc_query.output,
+ "Found regular expression '%s' in query result",
+ config.expect_re_str);
} else if (err == REG_NOMATCH) {
sc_query = mp_set_subcheck_state(sc_query, STATE_CRITICAL);
mopl_utils_xasprintf(&sc_query.output,
- "Did not find regular expression '%s' in query result",
- config.expect_re_str);
+ "Did not find regular expression '%s' in query result",
+ config.expect_re_str);
} else {
char errmsg[1024];
regerror(err, &expect_re, errmsg, sizeof(errmsg));
mopl_utils_xasprintf(&sc_query.output,
- "ERROR - failed to execute regular expression: %s\n", errmsg);
+ "ERROR - failed to execute regular expression: %s\n",
+ errmsg);
sc_query = mp_set_subcheck_state(sc_query, STATE_CRITICAL);
}
} else {
@@ -368,7 +373,7 @@ int main(int argc, char **argv) {
// so we expected a number
// this is a CRITICAL
mopl_utils_xasprintf(&sc_query.output, "Query '%s' result is not numeric",
- config.query);
+ config.query);
sc_query = mp_set_subcheck_state(sc_query, STATE_CRITICAL);
} else {
@@ -390,12 +395,12 @@ int main(int argc, char **argv) {
if (query_numerical_result == STATE_OK) {
mopl_utils_xasprintf(&sc_query.output,
- "Query result '%f' is within given thresholds",
- query_res.result_number);
+ "Query result '%f' is within given thresholds",
+ query_res.result_number);
} else {
mopl_utils_xasprintf(&sc_query.output,
- "Query result '%f' violates the given thresholds",
- query_res.result_number);
+ "Query result '%f' violates the given thresholds",
+ query_res.result_number);
}
}
}
@@ -404,11 +409,13 @@ int main(int argc, char **argv) {
mp_set_subcheck_state(sc_query, query_time_status);
if (query_time_status == STATE_OK) {
- mopl_utils_xasprintf(&sc_query.output, "Query duration '%f' is within given thresholds",
- query_res.query_duration);
+ mopl_utils_xasprintf(&sc_query.output,
+ "Query duration '%f' is within given thresholds",
+ query_res.query_duration);
} else {
- mopl_utils_xasprintf(&sc_query.output, "Query duration '%f' violates the given thresholds",
- query_res.query_duration);
+ mopl_utils_xasprintf(&sc_query.output,
+ "Query duration '%f' violates the given thresholds",
+ query_res.query_duration);
}
} else {
/* In case of METRIC_QUERY_RESULT, isnan(query_val) indicates an error
diff --git a/plugins/check_dig.c b/plugins/check_dig.c
index a8e33fd4..c74b0112 100644
--- a/plugins/check_dig.c
+++ b/plugins/check_dig.c
@@ -89,8 +89,9 @@ int main(int argc, char **argv) {
char *command_line;
/* get the command to run */
mopl_utils_xasprintf(&command_line, "%s %s %s -p %d @%s %s %s +retry=%d +time=%d", PATH_TO_DIG,
- config.dig_args, config.query_transport, config.server_port, config.dns_server,
- config.query_address, config.record_type, config.number_tries, timeout_interval_dig);
+ config.dig_args, config.query_transport, config.server_port,
+ config.dns_server, config.query_address, config.record_type,
+ config.number_tries, timeout_interval_dig);
alarm(timeout_interval);
struct timeval start_time;
@@ -211,11 +212,11 @@ int main(int argc, char **argv) {
result = STATE_CRITICAL;
if (!msg) {
mopl_utils_xasprintf(&msg, _("Missing required DNS flag: %s"),
- config.require_flags.items[r]);
+ config.require_flags.items[r]);
} else {
char *newmsg = NULL;
mopl_utils_xasprintf(&newmsg, _("%s; missing required DNS flag: %s"), msg,
- config.require_flags.items[r]);
+ config.require_flags.items[r]);
msg = newmsg;
}
}
@@ -226,11 +227,11 @@ int main(int argc, char **argv) {
result = STATE_CRITICAL;
if (!msg) {
mopl_utils_xasprintf(&msg, _("Forbidden DNS flag present: %s"),
- config.forbid_flags.items[r]);
+ config.forbid_flags.items[r]);
} else {
char *newmsg = NULL;
mopl_utils_xasprintf(&newmsg, _("%s; forbidden DNS flag present: %s"), msg,
- config.forbid_flags.items[r]);
+ config.forbid_flags.items[r]);
msg = newmsg;
}
}
@@ -244,8 +245,8 @@ int main(int argc, char **argv) {
printf("DNS %s - %.3f seconds response time (%s)|%s\n", state_text(result), elapsed_time,
msg ? msg : _("Probably a non-existent host/domain"),
mopl_utils_fperfdata("time", elapsed_time, "s", (config.warning_interval > UNDEFINED),
- config.warning_interval, (config.critical_interval > UNDEFINED),
- config.critical_interval, true, 0, false, 0));
+ config.warning_interval, (config.critical_interval > UNDEFINED),
+ config.critical_interval, true, 0, false, 0));
exit(result);
}
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index f254d848..5a9ffee1 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -172,7 +172,8 @@ int main(int argc, char **argv) {
if (config.path_select_list.length == 0) {
mp_subcheck none_sc = mp_subcheck_init();
- mopl_utils_xasprintf(&none_sc.output, "No filesystems were found for the provided parameters");
+ mopl_utils_xasprintf(&none_sc.output,
+ "No filesystems were found for the provided parameters");
if (config.ignore_missing) {
none_sc = mp_set_subcheck_state(none_sc, STATE_OK);
} else {
@@ -348,7 +349,8 @@ int main(int argc, char **argv) {
} else {
// Apparently no machting fs found
mp_subcheck none_sc = mp_subcheck_init();
- mopl_utils_xasprintf(&none_sc.output, "No filesystems were found for the provided parameters");
+ mopl_utils_xasprintf(&none_sc.output,
+ "No filesystems were found for the provided parameters");
if (config.ignore_missing) {
none_sc = mp_set_subcheck_state(none_sc, STATE_OK);
@@ -1192,7 +1194,8 @@ mp_subcheck evaluate_filesystem(measurement_unit measurement_unit, bool display_
mopl_utils_xasprintf(&result.output, "%s", measurement_unit.name);
if (!measurement_unit.is_group && measurement_unit.filesystem_type) {
- mopl_utils_xasprintf(&result.output, "%s (%s)", result.output, measurement_unit.filesystem_type);
+ mopl_utils_xasprintf(&result.output, "%s (%s)", result.output,
+ measurement_unit.filesystem_type);
}
/* Threshold comparisons */
@@ -1204,12 +1207,14 @@ mp_subcheck evaluate_filesystem(measurement_unit measurement_unit, bool display_
if (unit != Humanized) {
mopl_utils_xasprintf(&freespace_bytes_sc.output, "Free space absolute: %ju%s (of %ju%s)",
- (uintmax_t)(measurement_unit.free_bytes / unit), get_unit_string(unit),
- (uintmax_t)(measurement_unit.total_bytes / unit), get_unit_string(unit));
+ (uintmax_t)(measurement_unit.free_bytes / unit), get_unit_string(unit),
+ (uintmax_t)(measurement_unit.total_bytes / unit),
+ get_unit_string(unit));
} else {
- mopl_utils_xasprintf(&freespace_bytes_sc.output, "Free space absolute: %s (of %s)",
- humanize_byte_value(measurement_unit.free_bytes, false),
- humanize_byte_value((unsigned long long)measurement_unit.total_bytes, false));
+ mopl_utils_xasprintf(
+ &freespace_bytes_sc.output, "Free space absolute: %s (of %s)",
+ humanize_byte_value(measurement_unit.free_bytes, false),
+ humanize_byte_value((unsigned long long)measurement_unit.total_bytes, false));
}
// Free space just internally for computation
@@ -1293,7 +1298,8 @@ mp_subcheck evaluate_filesystem(measurement_unit measurement_unit, bool display_
double free_percentage =
calculate_percent(measurement_unit.free_bytes, measurement_unit.total_bytes);
- mopl_utils_xasprintf(&freespace_percent_sc.output, "Free space percentage: %g%%", free_percentage);
+ mopl_utils_xasprintf(&freespace_percent_sc.output, "Free space percentage: %g%%",
+ free_percentage);
// Using perfdata here just to get to the test result
mp_perfdata free_space_percent_pd = perfdata_init();
@@ -1327,8 +1333,8 @@ mp_subcheck evaluate_filesystem(measurement_unit measurement_unit, bool display_
}
mopl_utils_xasprintf(&freeindodes_percent_sc.output, "Inodes free: %g%% (%ju of %ju)",
- free_inode_percentage, measurement_unit.inodes_free,
- measurement_unit.inodes_total);
+ free_inode_percentage, measurement_unit.inodes_free,
+ measurement_unit.inodes_total);
mp_perfdata inodes_pd = perfdata_init();
mopl_utils_xasprintf(&inodes_pd.label, "%s (inodes)", measurement_unit.name);
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index 703fae3a..24ce39d7 100644
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
@@ -87,7 +87,8 @@ int main(int argc, char **argv) {
char *command_line = NULL;
/* get the command to run */
- mopl_utils_xasprintf(&command_line, "%s %s %s", NSLOOKUP_COMMAND, config.query_address, config.dns_server);
+ mopl_utils_xasprintf(&command_line, "%s %s %s", NSLOOKUP_COMMAND, config.query_address,
+ config.dns_server);
struct timeval tv;
alarm(timeout_interval);
@@ -290,8 +291,8 @@ int main(int argc, char **argv) {
if (config.expect_nxdomain) {
if (!is_nxdomain) {
result = STATE_CRITICAL;
- mopl_utils_xasprintf(&msg, _("Domain '%s' was found by the server: '%s'\n"), config.query_address,
- address);
+ mopl_utils_xasprintf(&msg, _("Domain '%s' was found by the server: '%s'\n"),
+ config.query_address, address);
} else {
if (address != NULL) {
free(address);
@@ -304,7 +305,7 @@ int main(int argc, char **argv) {
if (result == STATE_OK && config.expect_authority && non_authoritative) {
result = STATE_CRITICAL;
mopl_utils_xasprintf(&msg, _("server %s is not authoritative for %s"), config.dns_server,
- config.query_address);
+ config.query_address);
}
long microsec = mopl_utils_deltime(tv);
@@ -325,20 +326,22 @@ int main(int argc, char **argv) {
if ((config.time_thresholds->warning != NULL) &&
(config.time_thresholds->critical != NULL)) {
printf("|%s\n",
- mopl_utils_fperfdata("time", elapsed_time, "s", true, config.time_thresholds->warning->end,
- true, config.time_thresholds->critical->end, true, 0, false, 0));
+ mopl_utils_fperfdata("time", elapsed_time, "s", true,
+ config.time_thresholds->warning->end, true,
+ config.time_thresholds->critical->end, true, 0, false, 0));
} else if ((config.time_thresholds->warning == NULL) &&
(config.time_thresholds->critical != NULL)) {
- printf("|%s\n", mopl_utils_fperfdata("time", elapsed_time, "s", false, 0, true,
- config.time_thresholds->critical->end, true, 0, false, 0));
+ printf("|%s\n",
+ mopl_utils_fperfdata("time", elapsed_time, "s", false, 0, true,
+ config.time_thresholds->critical->end, true, 0, false, 0));
} else if ((config.time_thresholds->warning != NULL) &&
(config.time_thresholds->critical == NULL)) {
- printf("|%s\n",
- mopl_utils_fperfdata("time", elapsed_time, "s", true, config.time_thresholds->warning->end,
- false, 0, true, 0, false, 0));
+ printf("|%s\n", mopl_utils_fperfdata("time", elapsed_time, "s", true,
+ config.time_thresholds->warning->end, false, 0,
+ true, 0, false, 0));
} else {
- printf("|%s\n",
- mopl_utils_fperfdata("time", elapsed_time, "s", false, 0, false, 0, true, 0, false, 0));
+ printf("|%s\n", mopl_utils_fperfdata("time", elapsed_time, "s", false, 0, false, 0,
+ true, 0, false, 0));
}
} else if (result == STATE_WARNING) {
printf(_("DNS WARNING - %s\n"),
diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index e349eb4d..e67a8e53 100644
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
@@ -134,11 +134,11 @@ int main(int argc, char **argv) {
if (config.icmp_timestamp) {
// no packet size settable for ICMP timestamp
- mopl_utils_xasprintf(&command_line, "%s %s -c %d %s", fping_prog, option_string, config.packet_count,
- server);
+ mopl_utils_xasprintf(&command_line, "%s %s -c %d %s", fping_prog, option_string,
+ config.packet_count, server);
} else {
mopl_utils_xasprintf(&command_line, "%s %s-b %d -c %d %s", fping_prog, option_string,
- config.packet_size, config.packet_count, server);
+ config.packet_size, config.packet_count, server);
}
if (verbose) {
@@ -219,8 +219,8 @@ mp_state_enum textscan(char *buf, const char *server_name, bool crta_p, double c
die(STATE_OK, _("FPING %s - %s (rta=%f ms)|%s\n"), state_text(STATE_OK), server_name, rta,
/* No loss since we only waited for the first reply
perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, true, 0, true, 100), */
- mopl_utils_fperfdata("rta", rta / 1.0e3, "s", wrta_p, wrta / 1.0e3, crta_p, crta / 1.0e3, true, 0,
- false, 0));
+ mopl_utils_fperfdata("rta", rta / 1.0e3, "s", wrta_p, wrta / 1.0e3, crta_p,
+ crta / 1.0e3, true, 0, false, 0));
}
mp_state_enum status = STATE_UNKNOWN;
@@ -263,9 +263,10 @@ mp_state_enum textscan(char *buf, const char *server_name, bool crta_p, double c
}
die(status, _("FPING %s - %s (loss=%.0f%%, rta=%f ms)|%s %s\n"), state_text(status),
server_name, loss, rta,
- mopl_utils_perfdata("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, false, 0, false, 0),
- mopl_utils_fperfdata("rta", rta / 1.0e3, "s", wrta_p, wrta / 1.0e3, crta_p, crta / 1.0e3, true, 0,
- false, 0));
+ mopl_utils_perfdata("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, false, 0,
+ false, 0),
+ mopl_utils_fperfdata("rta", rta / 1.0e3, "s", wrta_p, wrta / 1.0e3, crta_p,
+ crta / 1.0e3, true, 0, false, 0));
} else if (strstr(buf, "xmt/rcv/%loss")) {
/* no min/max/avg if host was unreachable in fping v2.2.b1 */
@@ -290,7 +291,8 @@ mp_state_enum textscan(char *buf, const char *server_name, bool crta_p, double c
}
/* loss=%.0f%%;%d;%d;0;100 */
die(status, _("FPING %s - %s (loss=%.0f%% )|%s\n"), state_text(status), server_name, loss,
- mopl_utils_perfdata("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, false, 0, false, 0));
+ mopl_utils_perfdata("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, false, 0,
+ false, 0));
} else {
status = max_state(status, STATE_WARNING);
diff --git a/plugins/check_game.c b/plugins/check_game.c
index 8d04d597..6dbbf0f2 100644
--- a/plugins/check_game.c
+++ b/plugins/check_game.c
@@ -78,7 +78,7 @@ int main(int argc, char **argv) {
/* create the command line to execute */
char *command_line = NULL;
mopl_utils_xasprintf(&command_line, "%s -raw %s -%s %s", PATH_TO_QSTAT, QSTAT_DATA_DELIMITER,
- config.game_type, config.server_ip);
+ config.game_type, config.server_ip);
if (config.port) {
mopl_utils_xasprintf(&command_line, "%s:%-d", command_line, config.port);
@@ -134,10 +134,11 @@ int main(int argc, char **argv) {
printf("OK: %s/%s %s (%s), Ping: %s ms|%s %s\n", ret[config.qstat_game_players],
ret[config.qstat_game_players_max], ret[config.qstat_game_field],
ret[config.qstat_map_field], ret[config.qstat_ping_field],
- mopl_utils_perfdata("players", atol(ret[config.qstat_game_players]), "", false, 0, false, 0,
- true, 0, true, atol(ret[config.qstat_game_players_max])),
- mopl_utils_fperfdata("ping", strtod(ret[config.qstat_ping_field], NULL), "", false, 0, false, 0,
- true, 0, false, 0));
+ mopl_utils_perfdata("players", atol(ret[config.qstat_game_players]), "", false, 0,
+ false, 0, true, 0, true,
+ atol(ret[config.qstat_game_players_max])),
+ mopl_utils_fperfdata("ping", strtod(ret[config.qstat_ping_field], NULL), "", false,
+ 0, false, 0, true, 0, false, 0));
}
exit(result);
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 9fd30739..84b73812 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -161,8 +161,8 @@ int main(int argc, char **argv) {
/* Set default URL. Must be malloced for subsequent realloc if --onredirect=follow */
server_url = strdup(HTTP_URL);
server_url_length = strlen(server_url);
- mopl_utils_xasprintf(&user_agent, "User-Agent: check_http/v%s (monitoring-plugins %s)", NP_VERSION,
- VERSION);
+ mopl_utils_xasprintf(&user_agent, "User-Agent: check_http/v%s (monitoring-plugins %s)",
+ NP_VERSION, VERSION);
/* Parse extra opts if any */
argv = np_extra_opts(&argc, argv, progname);
@@ -312,9 +312,10 @@ bool process_arguments(int argc, char **argv) {
} else if (!strcmp(optarg, "3") || !strcasecmp(optarg, "unknown")) {
socket_timeout_state = STATE_UNKNOWN;
} else {
- mopl_utils_usage2(_("Invalid timeout-result state option, give either a return code or state "
- "name in lowercase"),
- optarg);
+ mopl_utils_usage2(
+ _("Invalid timeout-result state option, give either a return code or state "
+ "name in lowercase"),
+ optarg);
}
break;
case 'c': /* critical time threshold */
@@ -402,8 +403,9 @@ bool process_arguments(int argc, char **argv) {
} else if (optarg[0] == '2') {
ssl_version = got_plus ? MOPL_NET_SSLv2_OR_NEWER : MOPL_NET_SSLv2;
} else {
- mopl_utils_usage4(_("Invalid option - Valid SSL/TLS versions: 2, 3, 1, 1.1, 1.2 (with "
- "optional '+' suffix)"));
+ mopl_utils_usage4(
+ _("Invalid option - Valid SSL/TLS versions: 2, 3, 1, 1.1, 1.2 (with "
+ "optional '+' suffix)"));
}
}
if (!specify_port) {
@@ -426,13 +428,13 @@ bool process_arguments(int argc, char **argv) {
break;
case 'f': /* onredirect */
if (!strcmp(optarg, "stickyport")) {
- followsticky = STICKY_HOST | STICKY_PORT;
+ followsticky = STICKY_HOST | STICKY_PORT;
onredirect_dependent = true;
} else if (!strcmp(optarg, "sticky")) {
- followsticky = STICKY_HOST;
+ followsticky = STICKY_HOST;
onredirect_dependent = true;
} else if (!strcmp(optarg, "follow")) {
- followsticky = STICKY_NONE;
+ followsticky = STICKY_NONE;
onredirect_dependent = true;
} else if (!strcmp(optarg, "unknown")) {
onredirect = STATE_UNKNOWN;
@@ -656,7 +658,8 @@ bool process_arguments(int argc, char **argv) {
}
if (client_cert && !client_privkey) {
- mopl_utils_usage4(_("If you use a client certificate you must also specify a private key file"));
+ mopl_utils_usage4(
+ _("If you use a client certificate you must also specify a private key file"));
}
if (virtual_port == 0) {
@@ -860,21 +863,22 @@ static int check_document_dates(const char *headers, char **msg) {
mopl_utils_xasprintf(msg, _("%sServer date \"%100s\" unparsable, "), *msg, server_date);
date_result = max_state_alt(STATE_CRITICAL, date_result);
} else if (doc_data <= 0) {
- mopl_utils_xasprintf(msg, _("%sDocument date \"%100s\" unparsable, "), *msg, document_date);
+ mopl_utils_xasprintf(msg, _("%sDocument date \"%100s\" unparsable, "), *msg,
+ document_date);
date_result = max_state_alt(STATE_CRITICAL, date_result);
} else if (doc_data > srv_data + 30) {
mopl_utils_xasprintf(msg, _("%sDocument is %d seconds in the future, "), *msg,
- (int)doc_data - (int)srv_data);
+ (int)doc_data - (int)srv_data);
date_result = max_state_alt(STATE_CRITICAL, date_result);
} else if (doc_data < srv_data - maximum_age) {
int n = (srv_data - doc_data);
if (n > (60 * 60 * 24 * 2)) {
mopl_utils_xasprintf(msg, _("%sLast modified %.1f days ago, "), *msg,
- ((float)n) / (60 * 60 * 24));
+ ((float)n) / (60 * 60 * 24));
date_result = max_state_alt(STATE_CRITICAL, date_result);
} else {
- mopl_utils_xasprintf(msg, _("%sLast modified %d:%02d:%02d ago, "), *msg, n / (60 * 60),
- (n / 60) % 60, n % 60);
+ mopl_utils_xasprintf(msg, _("%sLast modified %d:%02d:%02d ago, "), *msg,
+ n / (60 * 60), (n / 60) % 60, n % 60);
date_result = max_state_alt(STATE_CRITICAL, date_result);
}
}
@@ -1142,10 +1146,12 @@ int check_http(void) {
if (http_content_type) {
mopl_utils_xasprintf(&buf, "%sContent-Type: %s\r\n", buf, http_content_type);
} else {
- mopl_utils_xasprintf(&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf);
+ mopl_utils_xasprintf(&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n",
+ buf);
}
- mopl_utils_xasprintf(&buf, "%sContent-Length: %i\r\n\r\n", buf, (int)strlen(http_post_data));
+ mopl_utils_xasprintf(&buf, "%sContent-Length: %i\r\n\r\n", buf,
+ (int)strlen(http_post_data));
mopl_utils_xasprintf(&buf, "%s%s", buf, http_post_data);
} else {
/* or just a newline so the server knows we're done with the request */
@@ -1254,10 +1260,12 @@ int check_http(void) {
/* make sure the status line matches the response we are looking for */
if (!expected_statuscode(status_line, server_expect)) {
if (server_port == HTTP_PORT) {
- mopl_utils_xasprintf(&msg, _("Invalid HTTP response received from host: %s\n"), status_line);
+ mopl_utils_xasprintf(&msg, _("Invalid HTTP response received from host: %s\n"),
+ status_line);
} else {
- mopl_utils_xasprintf(&msg, _("Invalid HTTP response received from host on port %d: %s\n"),
- server_port, status_line);
+ mopl_utils_xasprintf(&msg,
+ _("Invalid HTTP response received from host on port %d: %s\n"),
+ server_port, status_line);
}
if (show_body) {
mopl_utils_xasprintf(&msg, _("%s\n%s"), msg, page);
@@ -1336,8 +1344,8 @@ int check_http(void) {
}
mopl_utils_xasprintf(&msg, _("%sheader '%s' not found on '%s://%s:%d%s', "), msg,
- output_header_search, use_ssl ? "https" : "http",
- host_name ? host_name : server_address, server_port, server_url);
+ output_header_search, use_ssl ? "https" : "http",
+ host_name ? host_name : server_address, server_port, server_url);
result = STATE_CRITICAL;
}
@@ -1378,8 +1386,8 @@ int check_http(void) {
bcopy("...", &output_string_search[sizeof(output_string_search) - 4], 4);
}
mopl_utils_xasprintf(&msg, _("%sstring '%s' not found on '%s://%s:%d%s', "), msg,
- output_string_search, use_ssl ? "https" : "http",
- host_name ? host_name : server_address, server_port, server_url);
+ output_string_search, use_ssl ? "https" : "http",
+ host_name ? host_name : server_address, server_port, server_url);
result = STATE_CRITICAL;
}
}
@@ -1440,9 +1448,9 @@ int check_http(void) {
perfd_time_headers(elapsed_time_headers), perfd_time_firstbyte(elapsed_time_firstbyte),
perfd_time_transfer(elapsed_time_transfer));
} else {
- mopl_utils_xasprintf(&msg, _("%s - %d bytes in %.3f second response time %s|%s %s"), msg, page_len,
- elapsed_time, (display_html ? "</A>" : ""), perfd_time(elapsed_time),
- perfd_size(page_len));
+ mopl_utils_xasprintf(&msg, _("%s - %d bytes in %.3f second response time %s|%s %s"), msg,
+ page_len, elapsed_time, (display_html ? "</A>" : ""),
+ perfd_time(elapsed_time), perfd_size(page_len));
}
if (show_body) {
@@ -1727,39 +1735,39 @@ int server_port_check(int ssl_flag) {
}
char *perfd_time(double elapsed_time) {
- return mopl_utils_fperfdata("time", elapsed_time, "s", thlds->warning,
- thlds->warning ? thlds->warning->end : 0, thlds->critical,
- thlds->critical ? thlds->critical->end : 0, true, 0, true, socket_timeout);
+ return mopl_utils_fperfdata(
+ "time", elapsed_time, "s", thlds->warning, thlds->warning ? thlds->warning->end : 0,
+ thlds->critical, thlds->critical ? thlds->critical->end : 0, true, 0, true, socket_timeout);
}
char *perfd_time_connect(double elapsed_time_connect) {
- return mopl_utils_fperfdata("time_connect", elapsed_time_connect, "s", false, 0, false, 0, false, 0, true,
- socket_timeout);
+ return mopl_utils_fperfdata("time_connect", elapsed_time_connect, "s", false, 0, false, 0,
+ false, 0, true, socket_timeout);
}
char *perfd_time_ssl(double elapsed_time_ssl) {
- return mopl_utils_fperfdata("time_ssl", elapsed_time_ssl, "s", false, 0, false, 0, false, 0, true,
- socket_timeout);
+ return mopl_utils_fperfdata("time_ssl", elapsed_time_ssl, "s", false, 0, false, 0, false, 0,
+ true, socket_timeout);
}
char *perfd_time_headers(double elapsed_time_headers) {
- return mopl_utils_fperfdata("time_headers", elapsed_time_headers, "s", false, 0, false, 0, false, 0, true,
- socket_timeout);
+ return mopl_utils_fperfdata("time_headers", elapsed_time_headers, "s", false, 0, false, 0,
+ false, 0, true, socket_timeout);
}
char *perfd_time_firstbyte(double elapsed_time_firstbyte) {
- return mopl_utils_fperfdata("time_firstbyte", elapsed_time_firstbyte, "s", false, 0, false, 0, false, 0,
- true, socket_timeout);
+ return mopl_utils_fperfdata("time_firstbyte", elapsed_time_firstbyte, "s", false, 0, false, 0,
+ false, 0, true, socket_timeout);
}
char *perfd_time_transfer(double elapsed_time_transfer) {
- return mopl_utils_fperfdata("time_transfer", elapsed_time_transfer, "s", false, 0, false, 0, false, 0,
- true, socket_timeout);
+ return mopl_utils_fperfdata("time_transfer", elapsed_time_transfer, "s", false, 0, false, 0,
+ false, 0, true, socket_timeout);
}
char *perfd_size(int page_len) {
- return mopl_utils_perfdata("size", page_len, "B", (min_page_len > 0), min_page_len, (min_page_len > 0), 0,
- true, 0, false, 0);
+ return mopl_utils_perfdata("size", page_len, "B", (min_page_len > 0), min_page_len,
+ (min_page_len > 0), 0, true, 0, false, 0);
}
void print_help(void) {
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c
index 04c92b79..e92e4282 100644
--- a/plugins/check_ldap.c
+++ b/plugins/check_ldap.c
@@ -107,12 +107,13 @@ int main(int argc, char *argv[]) {
mp_subcheck sc_ldap_init = mp_subcheck_init();
if (!(ldap_connection = ldap_init(config.ld_host, config.ld_port))) {
mopl_utils_xasprintf(&sc_ldap_init.output, "could not connect to the server at port %i",
- config.ld_port);
+ config.ld_port);
sc_ldap_init = mp_set_subcheck_state(sc_ldap_init, STATE_CRITICAL);
mp_add_subcheck_to_check(&overall, sc_ldap_init);
mp_exit(overall);
} else {
- mopl_utils_xasprintf(&sc_ldap_init.output, "connected to the server at port %i", config.ld_port);
+ mopl_utils_xasprintf(&sc_ldap_init.output, "connected to the server at port %i",
+ config.ld_port);
sc_ldap_init = mp_set_subcheck_state(sc_ldap_init, STATE_OK);
mp_add_subcheck_to_check(&overall, sc_ldap_init);
}
@@ -127,7 +128,8 @@ int main(int argc, char *argv[]) {
mp_add_subcheck_to_check(&overall, sc_ldap_init);
mp_exit(overall);
} else {
- mopl_utils_xasprintf(&sc_ldap_init.output, "connected to the server at port %i", config.ld_port);
+ mopl_utils_xasprintf(&sc_ldap_init.output, "connected to the server at port %i",
+ config.ld_port);
sc_ldap_init = mp_set_subcheck_state(sc_ldap_init, STATE_OK);
mp_add_subcheck_to_check(&overall, sc_ldap_init);
}
@@ -140,12 +142,13 @@ int main(int argc, char *argv[]) {
if (ldap_set_option(ldap_connection, LDAP_OPT_PROTOCOL_VERSION, &config.ld_protocol) !=
LDAP_OPT_SUCCESS) {
mopl_utils_xasprintf(&sc_ldap_set_opts.output, "Could not set protocol version %d",
- config.ld_protocol);
+ config.ld_protocol);
sc_ldap_set_opts = mp_set_subcheck_state(sc_ldap_set_opts, STATE_CRITICAL);
mp_add_subcheck_to_check(&overall, sc_ldap_set_opts);
mp_exit(overall);
} else {
- mopl_utils_xasprintf(&sc_ldap_set_opts.output, "set protocol version %d", config.ld_protocol);
+ mopl_utils_xasprintf(&sc_ldap_set_opts.output, "set protocol version %d",
+ config.ld_protocol);
sc_ldap_set_opts = mp_set_subcheck_state(sc_ldap_set_opts, STATE_OK);
mp_add_subcheck_to_check(&overall, sc_ldap_set_opts);
}
@@ -165,12 +168,13 @@ int main(int argc, char *argv[]) {
ldap_perror(ldap_connection, "ldaps_option");
}
mopl_utils_xasprintf(&sc_ldap_tls_init.output, "could not init TLS at port %i!",
- config.ld_port);
+ config.ld_port);
sc_ldap_tls_init = mp_set_subcheck_state(sc_ldap_tls_init, STATE_CRITICAL);
mp_add_subcheck_to_check(&overall, sc_ldap_tls_init);
mp_exit(overall);
} else {
- mopl_utils_xasprintf(&sc_ldap_tls_init.output, "initiated TLS at port %i!", config.ld_port);
+ mopl_utils_xasprintf(&sc_ldap_tls_init.output, "initiated TLS at port %i!",
+ config.ld_port);
sc_ldap_tls_init = mp_set_subcheck_state(sc_ldap_tls_init, STATE_OK);
mp_add_subcheck_to_check(&overall, sc_ldap_tls_init);
}
@@ -194,14 +198,14 @@ int main(int argc, char *argv[]) {
if (verbose) {
ldap_perror(ldap_connection, "ldap_start_tls");
}
- mopl_utils_xasprintf(&sc_ldap_starttls.output, "could not init STARTTLS at port %i!",
- config.ld_port);
+ mopl_utils_xasprintf(&sc_ldap_starttls.output,
+ "could not init STARTTLS at port %i!", config.ld_port);
sc_ldap_starttls = mp_set_subcheck_state(sc_ldap_starttls, STATE_CRITICAL);
mp_add_subcheck_to_check(&overall, sc_ldap_starttls);
mp_exit(overall);
} else {
mopl_utils_xasprintf(&sc_ldap_starttls.output, "initiated STARTTLS at port %i!",
- config.ld_port);
+ config.ld_port);
sc_ldap_starttls = mp_set_subcheck_state(sc_ldap_starttls, STATE_OK);
mp_add_subcheck_to_check(&overall, sc_ldap_starttls);
}
@@ -223,7 +227,7 @@ int main(int argc, char *argv[]) {
}
mopl_utils_xasprintf(&sc_ldap_bind.output, "could not bind to the LDAP server: %s",
- ldap_err2string(ldap_error));
+ ldap_err2string(ldap_error));
sc_ldap_bind = mp_set_subcheck_state(sc_ldap_bind, STATE_CRITICAL);
mp_add_subcheck_to_check(&overall, sc_ldap_bind);
mp_exit(overall);
@@ -249,13 +253,15 @@ int main(int argc, char *argv[]) {
if (verbose) {
ldap_perror(ldap_connection, "ldap_search");
}
- mopl_utils_xasprintf(&sc_ldap_search.output, "could not search/find objectclasses in %s: %s",
- config.ld_base, ldap_err2string(ldap_error));
+ mopl_utils_xasprintf(&sc_ldap_search.output,
+ "could not search/find objectclasses in %s: %s", config.ld_base,
+ ldap_err2string(ldap_error));
sc_ldap_search = mp_set_subcheck_state(sc_ldap_search, STATE_CRITICAL);
mp_add_subcheck_to_check(&overall, sc_ldap_search);
mp_exit(overall);
} else {
- mopl_utils_xasprintf(&sc_ldap_search.output, "search/find objectclasses in %s", config.ld_base);
+ mopl_utils_xasprintf(&sc_ldap_search.output, "search/find objectclasses in %s",
+ config.ld_base);
sc_ldap_search = mp_set_subcheck_state(sc_ldap_search, STATE_OK);
mp_add_subcheck_to_check(&overall, sc_ldap_search);
}
@@ -287,11 +293,11 @@ int main(int argc, char *argv[]) {
sc_connection_time = mp_set_subcheck_state(sc_connection_time, connection_time_state);
if (connection_time_state == STATE_OK) {
- mopl_utils_xasprintf(&sc_connection_time.output, "connection time %.3fs is within thresholds",
- elapsed_time);
+ mopl_utils_xasprintf(&sc_connection_time.output,
+ "connection time %.3fs is within thresholds", elapsed_time);
} else {
- mopl_utils_xasprintf(&sc_connection_time.output, "connection time %.3fs is violating thresholds",
- elapsed_time);
+ mopl_utils_xasprintf(&sc_connection_time.output,
+ "connection time %.3fs is violating thresholds", elapsed_time);
}
mp_add_subcheck_to_check(&overall, sc_connection_time);
@@ -450,7 +456,8 @@ check_ldap_config_wrapper process_arguments(int argc, char **argv) {
if (!result.config.ssl_on_connect) {
result.config.starttls = true;
} else {
- mopl_utils_usage_va(_("%s cannot be combined with %s"), "-T/--starttls", "-S/--ssl");
+ mopl_utils_usage_va(_("%s cannot be combined with %s"), "-T/--starttls",
+ "-S/--ssl");
}
break;
case 'S':
@@ -460,7 +467,8 @@ check_ldap_config_wrapper process_arguments(int argc, char **argv) {
result.config.ld_port = LDAPS_PORT;
}
} else {
- mopl_utils_usage_va(_("%s cannot be combined with %s"), "-S/--ssl", "-T/--starttls");
+ mopl_utils_usage_va(_("%s cannot be combined with %s"), "-S/--ssl",
+ "-T/--starttls");
}
break;
case '6':
diff --git a/plugins/check_load.c b/plugins/check_load.c
index 62937461..5444c1cb 100644
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
@@ -173,8 +173,8 @@ int main(int argc, char **argv) {
}
char *ok_summary = NULL;
- mopl_utils_xasprintf(&ok_summary, "Load: 1m: %f - 5m: %f - 15m: %f", load_values[0], load_values[1],
- load_values[2]);
+ mopl_utils_xasprintf(&ok_summary, "Load: 1m: %f - 5m: %f - 15m: %f", load_values[0],
+ load_values[1], load_values[2]);
mp_set_ok_summary(&overall, ok_summary);
free(ok_summary);
@@ -189,8 +189,8 @@ int main(int argc, char **argv) {
load_values[2] / numcpus,
};
- mopl_utils_xasprintf(&ok_summary, "Scaled Load (%ld CPUs): 1m: %f - 5m: %f - 15m: %f", numcpus,
- load_values[0], load_values[1], load_values[2]);
+ mopl_utils_xasprintf(&ok_summary, "Scaled Load (%ld CPUs): 1m: %f - 5m: %f - 15m: %f",
+ numcpus, load_values[0], load_values[1], load_values[2]);
mp_set_ok_summary(&overall, ok_summary);
free(ok_summary);
@@ -207,7 +207,7 @@ int main(int argc, char **argv) {
scaled_load_sc1 = mp_set_subcheck_state(scaled_load_sc1, mp_get_pd_status(pd_scaled_load1));
mp_add_perfdata_to_subcheck(&scaled_load_sc1, pd_scaled_load1);
mopl_utils_xasprintf(&scaled_load_sc1.output, "1 Minute: %s",
- pd_value_to_string(pd_scaled_load1.value));
+ pd_value_to_string(pd_scaled_load1.value));
mp_add_subcheck_to_subcheck(&scaled_load_sc, scaled_load_sc1);
mp_perfdata pd_scaled_load5 = perfdata_init();
@@ -219,7 +219,7 @@ int main(int argc, char **argv) {
scaled_load_sc5 = mp_set_subcheck_state(scaled_load_sc5, mp_get_pd_status(pd_scaled_load5));
mp_add_perfdata_to_subcheck(&scaled_load_sc5, pd_scaled_load5);
mopl_utils_xasprintf(&scaled_load_sc5.output, "5 Minutes: %s",
- pd_value_to_string(pd_scaled_load5.value));
+ pd_value_to_string(pd_scaled_load5.value));
mp_add_subcheck_to_subcheck(&scaled_load_sc, scaled_load_sc5);
mp_perfdata pd_scaled_load15 = perfdata_init();
@@ -232,7 +232,7 @@ int main(int argc, char **argv) {
mp_set_subcheck_state(scaled_load_sc15, mp_get_pd_status(pd_scaled_load15));
mp_add_perfdata_to_subcheck(&scaled_load_sc15, pd_scaled_load15);
mopl_utils_xasprintf(&scaled_load_sc15.output, "15 Minutes: %s",
- pd_value_to_string(pd_scaled_load15.value));
+ pd_value_to_string(pd_scaled_load15.value));
mp_add_subcheck_to_subcheck(&scaled_load_sc, scaled_load_sc15);
mp_add_subcheck_to_check(&overall, scaled_load_sc);
@@ -288,13 +288,13 @@ int main(int argc, char **argv) {
top_proc_sc = mp_set_subcheck_state(top_proc_sc, STATE_OK);
top_processes_result top_proc = get_top_consuming_processes(config.n_procs_to_show);
mopl_utils_xasprintf(&top_proc_sc.output, "Top %lu CPU time consuming processes",
- config.n_procs_to_show);
+ config.n_procs_to_show);
if (top_proc.errorcode == OK) {
// +1 here since the string list contains the header line
for (unsigned long i = 0; i < config.n_procs_to_show + 1; i++) {
mopl_utils_xasprintf(&top_proc_sc.output, "%s\n%s", top_proc_sc.output,
- top_proc.top_processes[i]);
+ top_proc.top_processes[i]);
}
}
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c
index 37e29ae7..498d27c1 100644
--- a/plugins/check_mrtg.c
+++ b/plugins/check_mrtg.c
@@ -156,13 +156,13 @@ int main(int argc, char **argv) {
mp_subcheck sc_data_expired = mp_subcheck_init();
if (config.expire_minutes > 0 && (current_time - timestamp) > (config.expire_minutes * 60)) {
mopl_utils_xasprintf(&sc_data_expired.output, "MRTG data has expired (%d minutes old)",
- (int)((current_time - timestamp) / 60));
+ (int)((current_time - timestamp) / 60));
sc_data_expired = mp_set_subcheck_state(sc_data_expired, STATE_WARNING);
mp_add_subcheck_to_check(&overall, sc_data_expired);
mp_exit(overall);
} else {
mopl_utils_xasprintf(&sc_data_expired.output, "MRTG data should be valid (%d minutes old)",
- (int)((current_time - timestamp) / 60));
+ (int)((current_time - timestamp) / 60));
sc_data_expired = mp_set_subcheck_state(sc_data_expired, STATE_OK);
mp_add_subcheck_to_check(&overall, sc_data_expired);
}
@@ -182,8 +182,9 @@ int main(int argc, char **argv) {
pd_value = mp_pd_set_thresholds(pd_value, config.values_threshold);
sc_values = mp_set_subcheck_state(sc_values, mp_get_pd_status(pd_value));
- mopl_utils_xasprintf(&sc_values.output, "%s. %s = %lu %s", (config.use_average) ? _("Avg") : _("Max"),
- config.label, rate, config.units);
+ mopl_utils_xasprintf(&sc_values.output, "%s. %s = %lu %s",
+ (config.use_average) ? _("Avg") : _("Max"), config.label, rate,
+ config.units);
mp_add_subcheck_to_check(&overall, sc_values);
diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c
index fa0e73c0..07fe7068 100644
--- a/plugins/check_mrtgtraf.c
+++ b/plugins/check_mrtgtraf.c
@@ -144,14 +144,14 @@ int main(int argc, char **argv) {
mp_subcheck sc_expired = mp_subcheck_init();
if ((config.expire_minutes > 0) && (current_time - timestamp) > (config.expire_minutes * 60)) {
mopl_utils_xasprintf(&sc_expired.output, "MRTG data has expired (%d minutes old)",
- (int)((current_time - timestamp) / 60));
+ (int)((current_time - timestamp) / 60));
sc_expired = mp_set_subcheck_state(sc_expired, STATE_WARNING);
mp_add_subcheck_to_check(&overall, sc_expired);
mp_exit(overall);
}
mopl_utils_xasprintf(&sc_expired.output, "MRTG data should be valid (%d minutes old)",
- (int)((current_time - timestamp) / 60));
+ (int)((current_time - timestamp) / 60));
sc_expired = mp_set_subcheck_state(sc_expired, STATE_WARNING);
mp_add_subcheck_to_check(&overall, sc_expired);
@@ -217,15 +217,16 @@ int main(int argc, char **argv) {
mp_subcheck sc_rate_in = mp_subcheck_init();
sc_rate_in = mp_set_subcheck_state(sc_rate_in, mp_get_pd_status(pd_rate_in));
mp_add_perfdata_to_subcheck(&sc_rate_in, pd_rate_in);
- mopl_utils_xasprintf(&sc_rate_in.output, "%s. In = %0.1f %s/s", (config.use_average) ? _("Avg") : _("Max"),
- adjusted_incoming_rate, incoming_speed_rating);
+ mopl_utils_xasprintf(&sc_rate_in.output, "%s. In = %0.1f %s/s",
+ (config.use_average) ? _("Avg") : _("Max"), adjusted_incoming_rate,
+ incoming_speed_rating);
mp_subcheck sc_rate_out = mp_subcheck_init();
sc_rate_out = mp_set_subcheck_state(sc_rate_out, mp_get_pd_status(pd_rate_out));
mp_add_perfdata_to_subcheck(&sc_rate_out, pd_rate_out);
mopl_utils_xasprintf(&sc_rate_out.output, "%s. Out = %0.1f %s/s",
- (config.use_average) ? _("Avg") : _("Max"), adjusted_outgoing_rate,
- outgoing_speed_rating);
+ (config.use_average) ? _("Avg") : _("Max"), adjusted_outgoing_rate,
+ outgoing_speed_rating);
mp_subcheck sc_rate = mp_subcheck_init();
mopl_utils_xasprintf(&sc_rate.output, "Traffic");
diff --git a/plugins/check_mysql.d/config.h b/plugins/check_mysql.d/config.h
index 7fa66e79..f07b5667 100644
--- a/plugins/check_mysql.d/config.h
+++ b/plugins/check_mysql.d/config.h
@@ -23,7 +23,7 @@ typedef struct {
char *opt_group;
bool check_replica;
- char *replica_name;
+ char *replica_name;
bool ignore_auth;
@@ -51,7 +51,7 @@ check_mysql_config check_mysql_config_init() {
.opt_group = NULL,
.check_replica = false,
- .replica_name = NULL,
+ .replica_name = NULL,
.ignore_auth = false,
diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c
index 038a2836..75986821 100644
--- a/plugins/check_ntp_time.c
+++ b/plugins/check_ntp_time.c
@@ -763,7 +763,8 @@ void print_help(void) {
printf(" %s\n", "-o, --time-offset=INTEGER");
printf(" %s\n", _("Expected offset of the ntp server relative to local server (seconds)"));
printf(" %s\n", " --poll-delay=DELAY");
- printf(" %s\n", _("Delay between polling to avoid KOD response (seconds, 0.0 to 5.0, default 0.5 seconds)"));
+ printf(" %s\n", _("Delay between polling to avoid KOD response (seconds, 0.0 to 5.0, "
+ "default 0.5 seconds)"));
printf(UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
printf(UT_VERBOSE);
printf(UT_OUTPUT_FORMAT);
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c
index 8542f7e5..bf042f5b 100644
--- a/plugins/check_pgsql.c
+++ b/plugins/check_pgsql.c
@@ -221,7 +221,7 @@ int main(int argc, char **argv) {
if (PQstatus(conn) == CONNECTION_BAD) {
sc_connection = mp_set_subcheck_state(sc_connection, STATE_CRITICAL);
mopl_utils_xasprintf(&sc_connection.output, "no connection to '%s' (%s)", config.dbName,
- PQerrorMessage(conn));
+ PQerrorMessage(conn));
PQfinish(conn);
mp_add_subcheck_to_check(&overall, sc_connection);
mp_exit(overall);
@@ -288,35 +288,40 @@ int main(int argc, char **argv) {
mp_add_perfdata_to_subcheck(&sc_query_compare, pd_query);
if (query_compare_state == STATE_OK) {
- mopl_utils_xasprintf(&sc_query_compare.output, "query result '%f' is within thresholds",
- query_result.numerical_result);
+ mopl_utils_xasprintf(&sc_query_compare.output,
+ "query result '%f' is within thresholds",
+ query_result.numerical_result);
} else {
- mopl_utils_xasprintf(&sc_query_compare.output, "query result '%f' is violating thresholds",
- query_result.numerical_result);
+ mopl_utils_xasprintf(&sc_query_compare.output,
+ "query result '%f' is violating thresholds",
+ query_result.numerical_result);
}
mp_add_subcheck_to_check(&overall, sc_query_compare);
} break;
case ERROR_WITH_QUERY:
mopl_utils_xasprintf(&sc_query.output, "%s - Error with query: %s", sc_query.output,
- PQerrorMessage(conn));
+ PQerrorMessage(conn));
sc_query = mp_set_subcheck_state(sc_query, STATE_CRITICAL);
break;
case NO_ROWS_RETURNED:
- mopl_utils_xasprintf(&sc_query.output, "%s - no rows were returned by the query", sc_query.output);
+ mopl_utils_xasprintf(&sc_query.output, "%s - no rows were returned by the query",
+ sc_query.output);
sc_query = mp_set_subcheck_state(sc_query, STATE_WARNING);
break;
case NO_COLUMNS_RETURNED:
mopl_utils_xasprintf(&sc_query.output, "%s - no columns were returned by the query",
- sc_query.output);
+ sc_query.output);
sc_query = mp_set_subcheck_state(sc_query, STATE_WARNING);
break;
case NO_DATA_RETURNED:
- mopl_utils_xasprintf(&sc_query.output, "%s - no data was returned by the query", sc_query.output);
+ mopl_utils_xasprintf(&sc_query.output, "%s - no data was returned by the query",
+ sc_query.output);
sc_query = mp_set_subcheck_state(sc_query, STATE_WARNING);
break;
case RESULT_IS_NOT_NUMERIC:
- mopl_utils_xasprintf(&sc_query.output, "%s - result of the query is not numeric", sc_query.output);
+ mopl_utils_xasprintf(&sc_query.output, "%s - result of the query is not numeric",
+ sc_query.output);
sc_query = mp_set_subcheck_state(sc_query, STATE_CRITICAL);
break;
};
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index 70ef0d5a..de42b687 100644
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
@@ -355,13 +355,13 @@ int main(int argc, char **argv) {
if (temporary_result == STATE_WARNING) {
warn++;
mopl_utils_xasprintf(&config.fails, "%s%s%s", config.fails,
- (strcmp(config.fails, "") ? ", " : ""), procprog);
+ (strcmp(config.fails, "") ? ", " : ""), procprog);
result = max_state(result, temporary_result);
}
if (temporary_result == STATE_CRITICAL) {
crit++;
mopl_utils_xasprintf(&config.fails, "%s%s%s", config.fails,
- (strcmp(config.fails, "") ? ", " : ""), procprog);
+ (strcmp(config.fails, "") ? ", " : ""), procprog);
result = max_state(result, temporary_result);
}
}
@@ -491,8 +491,8 @@ check_procs_config_wrapper process_arguments(int argc, char **argv) {
static char tmp[MAX_INPUT_BUFFER];
if (sscanf(optarg, "%d%[^0-9]", &result.config.ppid, tmp) == 1) {
mopl_utils_xasprintf(&result.config.fmt, "%s%sPPID = %d",
- (result.config.fmt ? result.config.fmt : ""),
- (result.config.options ? ", " : ""), result.config.ppid);
+ (result.config.fmt ? result.config.fmt : ""),
+ (result.config.options ? ", " : ""), result.config.ppid);
result.config.options |= PPID;
break;
}
@@ -505,8 +505,8 @@ check_procs_config_wrapper process_arguments(int argc, char **argv) {
result.config.statopts = optarg;
}
mopl_utils_xasprintf(&result.config.fmt, _("%s%sSTATE = %s"),
- (result.config.fmt ? result.config.fmt : ""),
- (result.config.options ? ", " : ""), result.config.statopts);
+ (result.config.fmt ? result.config.fmt : ""),
+ (result.config.options ? ", " : ""), result.config.statopts);
result.config.options |= STAT;
break;
case 'u': /* user or user id */ {
@@ -530,8 +530,8 @@ check_procs_config_wrapper process_arguments(int argc, char **argv) {
char *user = pw->pw_name;
mopl_utils_xasprintf(&result.config.fmt, "%s%sUID = %d (%s)",
- (result.config.fmt ? result.config.fmt : ""),
- (result.config.options ? ", " : ""), result.config.uid, user);
+ (result.config.fmt ? result.config.fmt : ""),
+ (result.config.options ? ", " : ""), result.config.uid, user);
result.config.options |= USER;
} break;
case 'C': /* command */
@@ -542,8 +542,8 @@ check_procs_config_wrapper process_arguments(int argc, char **argv) {
result.config.prog = optarg;
}
mopl_utils_xasprintf(&result.config.fmt, _("%s%scommand name '%s'"),
- (result.config.fmt ? result.config.fmt : ""),
- (result.config.options ? ", " : ""), result.config.prog);
+ (result.config.fmt ? result.config.fmt : ""),
+ (result.config.options ? ", " : ""), result.config.prog);
result.config.options |= PROG;
break;
case 'X':
@@ -553,8 +553,8 @@ check_procs_config_wrapper process_arguments(int argc, char **argv) {
result.config.exclude_progs = optarg;
}
mopl_utils_xasprintf(&result.config.fmt, _("%s%sexclude progs '%s'"),
- (result.config.fmt ? result.config.fmt : ""),
- (result.config.options ? ", " : ""), result.config.exclude_progs);
+ (result.config.fmt ? result.config.fmt : ""),
+ (result.config.options ? ", " : ""), result.config.exclude_progs);
char *tmp_pointer = strtok(result.config.exclude_progs, ",");
while (tmp_pointer) {
@@ -576,8 +576,8 @@ check_procs_config_wrapper process_arguments(int argc, char **argv) {
result.config.args = optarg;
}
mopl_utils_xasprintf(&result.config.fmt, "%s%sargs '%s'",
- (result.config.fmt ? result.config.fmt : ""),
- (result.config.options ? ", " : ""), result.config.args);
+ (result.config.fmt ? result.config.fmt : ""),
+ (result.config.options ? ", " : ""), result.config.args);
result.config.options |= ARGS;
break;
case CHAR_MAX + 1: {
@@ -599,16 +599,16 @@ check_procs_config_wrapper process_arguments(int argc, char **argv) {
index++;
}
mopl_utils_xasprintf(&result.config.fmt, "%s%sregex args '%s'",
- (result.config.fmt ? result.config.fmt : ""),
- (result.config.options ? ", " : ""), temp_string);
+ (result.config.fmt ? result.config.fmt : ""),
+ (result.config.options ? ", " : ""), temp_string);
result.config.options |= EREG_ARGS;
} break;
case 'r': { /* RSS */
static char tmp[MAX_INPUT_BUFFER];
if (sscanf(optarg, "%d%[^0-9]", &result.config.rss, tmp) == 1) {
mopl_utils_xasprintf(&result.config.fmt, "%s%sRSS >= %d",
- (result.config.fmt ? result.config.fmt : ""),
- (result.config.options ? ", " : ""), result.config.rss);
+ (result.config.fmt ? result.config.fmt : ""),
+ (result.config.options ? ", " : ""), result.config.rss);
result.config.options |= RSS;
break;
}
@@ -618,8 +618,8 @@ check_procs_config_wrapper process_arguments(int argc, char **argv) {
static char tmp[MAX_INPUT_BUFFER];
if (sscanf(optarg, "%d%[^0-9]", &result.config.vsz, tmp) == 1) {
mopl_utils_xasprintf(&result.config.fmt, "%s%sVSZ >= %d",
- (result.config.fmt ? result.config.fmt : ""),
- (result.config.options ? ", " : ""), result.config.vsz);
+ (result.config.fmt ? result.config.fmt : ""),
+ (result.config.options ? ", " : ""), result.config.vsz);
result.config.options |= VSZ;
break;
}
@@ -630,8 +630,8 @@ check_procs_config_wrapper process_arguments(int argc, char **argv) {
static char tmp[MAX_INPUT_BUFFER];
if (sscanf(optarg, "%f%[^0-9.]", &result.config.pcpu, tmp) == 1) {
mopl_utils_xasprintf(&result.config.fmt, "%s%sPCPU >= %.2f",
- (result.config.fmt ? result.config.fmt : ""),
- (result.config.options ? ", " : ""), result.config.pcpu);
+ (result.config.fmt ? result.config.fmt : ""),
+ (result.config.options ? ", " : ""), result.config.pcpu);
result.config.options |= PCPU;
break;
}
@@ -686,8 +686,8 @@ check_procs_config_wrapper process_arguments(int argc, char **argv) {
if (result.config.statopts == NULL && argv[index]) {
mopl_utils_xasprintf(&result.config.statopts, "%s", argv[index++]);
mopl_utils_xasprintf(&result.config.fmt, _("%s%sSTATE = %s"),
- (result.config.fmt ? result.config.fmt : ""), (result.config.options ? ", " : ""),
- result.config.statopts);
+ (result.config.fmt ? result.config.fmt : ""),
+ (result.config.options ? ", " : ""), result.config.statopts);
result.config.options |= STAT;
}
diff --git a/plugins/check_real.c b/plugins/check_real.c
index 6b8f3695..36ee1876 100644
--- a/plugins/check_real.c
+++ b/plugins/check_real.c
@@ -92,14 +92,14 @@ int main(int argc, char **argv) {
int socket;
if (mopl_net_tcp_connect(config.server_address, config.server_port, &socket) != STATE_OK) {
mopl_utils_xasprintf(&sc_connect.output, _("unable to connect to %s on port %d"),
- config.server_address, config.server_port);
+ config.server_address, config.server_port);
sc_connect = mp_set_subcheck_state(sc_connect, STATE_CRITICAL);
mp_add_subcheck_to_check(&overall, sc_connect);
mp_exit(overall);
}
mopl_utils_xasprintf(&sc_connect.output, _("connected to %s on port %d"), config.server_address,
- config.server_port);
+ config.server_port);
sc_connect = mp_set_subcheck_state(sc_connect, STATE_OK);
mp_add_subcheck_to_check(&overall, sc_connect);
@@ -121,7 +121,8 @@ int main(int argc, char **argv) {
sprintf(send_buffer, "CSeq: 1\r\n");
sent_bytes = send(socket, send_buffer, strlen(send_buffer), 0);
if (sent_bytes == -1) {
- mopl_utils_xasprintf(&sc_send.output, _("Sending header sync to %s failed"), config.host_name);
+ mopl_utils_xasprintf(&sc_send.output, _("Sending header sync to %s failed"),
+ config.host_name);
sc_send = mp_set_subcheck_state(sc_send, STATE_CRITICAL);
mp_add_subcheck_to_check(&overall, sc_send);
mp_exit(overall);
@@ -157,11 +158,12 @@ int main(int argc, char **argv) {
/* make sure we find the response we are looking for */
if (!strstr(recv_buffer, config.server_expect)) {
if (config.server_port == PORT) {
- mopl_utils_xasprintf(&sc_options_request.output, "invalid REAL response received from host");
+ mopl_utils_xasprintf(&sc_options_request.output,
+ "invalid REAL response received from host");
} else {
mopl_utils_xasprintf(&sc_options_request.output,
- "invalid REAL response received from host on port %d",
- config.server_port);
+ "invalid REAL response received from host on port %d",
+ config.server_port);
}
sc_options_request = mp_set_subcheck_state(sc_options_request, STATE_CRITICAL);
mp_add_subcheck_to_check(&overall, sc_options_request);
@@ -226,7 +228,7 @@ int main(int argc, char **argv) {
if (sent_bytes == -1) {
sc_describe = mp_set_subcheck_state(sc_describe, STATE_CRITICAL);
mopl_utils_xasprintf(&sc_describe.output, "sending DESCRIBE request to %s failed",
- config.host_name);
+ config.host_name);
mp_add_subcheck_to_check(&overall, sc_describe);
mp_exit(overall);
}
@@ -237,7 +239,7 @@ int main(int argc, char **argv) {
if (sent_bytes == -1) {
sc_describe = mp_set_subcheck_state(sc_describe, STATE_CRITICAL);
mopl_utils_xasprintf(&sc_describe.output, "sending DESCRIBE request to %s failed",
- config.host_name);
+ config.host_name);
mp_add_subcheck_to_check(&overall, sc_describe);
mp_exit(overall);
}
@@ -248,7 +250,7 @@ int main(int argc, char **argv) {
if (sent_bytes == -1) {
sc_describe = mp_set_subcheck_state(sc_describe, STATE_CRITICAL);
mopl_utils_xasprintf(&sc_describe.output, "sending DESCRIBE request to %s failed",
- config.host_name);
+ config.host_name);
mp_add_subcheck_to_check(&overall, sc_describe);
mp_exit(overall);
}
@@ -260,7 +262,8 @@ int main(int argc, char **argv) {
if (recv_bytes == -1) {
/* return a CRITICAL status if we couldn't read any data */
sc_describe = mp_set_subcheck_state(sc_describe, STATE_CRITICAL);
- mopl_utils_xasprintf(&sc_describe.output, "No data received from host on DESCRIBE request");
+ mopl_utils_xasprintf(&sc_describe.output,
+ "No data received from host on DESCRIBE request");
mp_add_subcheck_to_check(&overall, sc_describe);
mp_exit(overall);
} else {
@@ -268,11 +271,12 @@ int main(int argc, char **argv) {
/* make sure we find the response we are looking for */
if (!strstr(recv_buffer, config.server_expect)) {
if (config.server_port == PORT) {
- mopl_utils_xasprintf(&sc_describe.output, "invalid REAL response received from host");
+ mopl_utils_xasprintf(&sc_describe.output,
+ "invalid REAL response received from host");
} else {
mopl_utils_xasprintf(&sc_describe.output,
- "invalid REAL response received from host on port %d",
- config.server_port);
+ "invalid REAL response received from host on port %d",
+ config.server_port);
}
sc_describe = mp_set_subcheck_state(sc_describe, STATE_UNKNOWN);
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index fc11adb2..94a0d52d 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -197,7 +197,8 @@ int main(int argc, char **argv) {
if (tcp_result != STATE_OK) {
// Connect failed
sc_tcp_connect = mp_set_subcheck_state(sc_tcp_connect, STATE_CRITICAL);
- mopl_utils_xasprintf(&sc_tcp_connect.output, "TCP connect to '%s' failed", config.server_address);
+ mopl_utils_xasprintf(&sc_tcp_connect.output, "TCP connect to '%s' failed",
+ config.server_address);
mp_add_subcheck_to_check(&overall, sc_tcp_connect);
mp_exit(overall);
}
@@ -365,13 +366,15 @@ int main(int argc, char **argv) {
if (cert_check_result.result_state != STATE_OK &&
config.ignore_certificate_expiration) {
- mopl_utils_xasprintf(&sc_cert_check.output,
- "Remaining certificate lifetime: %d days. Expiration will be ignored",
- (int)(cert_check_result.remaining_seconds / 86400));
+ mopl_utils_xasprintf(
+ &sc_cert_check.output,
+ "Remaining certificate lifetime: %d days. Expiration will be ignored",
+ (int)(cert_check_result.remaining_seconds / 86400));
sc_cert_check = mp_set_subcheck_state(sc_cert_check, STATE_OK);
} else {
- mopl_utils_xasprintf(&sc_cert_check.output, "Remaining certificate lifetime: %d days",
- (int)(cert_check_result.remaining_seconds / 86400));
+ mopl_utils_xasprintf(&sc_cert_check.output,
+ "Remaining certificate lifetime: %d days",
+ (int)(cert_check_result.remaining_seconds / 86400));
sc_cert_check =
mp_set_subcheck_state(sc_cert_check, cert_check_result.result_state);
}
@@ -411,17 +414,19 @@ int main(int argc, char **argv) {
if (!strstr(server_response, config.server_expect)) {
sc_expect_response = mp_set_subcheck_state(sc_expect_response, STATE_WARNING);
if (config.server_port == SMTP_PORT) {
- mopl_utils_xasprintf(&sc_expect_response.output, _("invalid SMTP response received from host: %s"),
- server_response);
+ mopl_utils_xasprintf(&sc_expect_response.output,
+ _("invalid SMTP response received from host: %s"),
+ server_response);
} else {
mopl_utils_xasprintf(&sc_expect_response.output,
- _("invalid SMTP response received from host on port %d: %s"),
- config.server_port, server_response);
+ _("invalid SMTP response received from host on port %d: %s"),
+ config.server_port, server_response);
}
exit(STATE_WARNING);
} else {
- mopl_utils_xasprintf(&sc_expect_response.output, "received valid SMTP response '%s' from host: '%s'",
- config.server_expect, server_response);
+ mopl_utils_xasprintf(&sc_expect_response.output,
+ "received valid SMTP response '%s' from host: '%s'",
+ config.server_expect, server_response);
sc_expect_response = mp_set_subcheck_state(sc_expect_response, STATE_OK);
}
@@ -462,16 +467,19 @@ int main(int argc, char **argv) {
int excode = regexec(&preg, buffer, 10, pmatch, eflags);
mp_subcheck sc_expected_responses = mp_subcheck_init();
if (excode == 0) {
- mopl_utils_xasprintf(&sc_expected_responses.output, "valid response '%s' to command '%s'",
- buffer, config.commands[counter]);
+ mopl_utils_xasprintf(&sc_expected_responses.output,
+ "valid response '%s' to command '%s'", buffer,
+ config.commands[counter]);
sc_expected_responses = mp_set_subcheck_state(sc_expected_responses, STATE_OK);
} else if (excode == REG_NOMATCH) {
sc_expected_responses = mp_set_subcheck_state(sc_expected_responses, STATE_WARNING);
- mopl_utils_xasprintf(&sc_expected_responses.output, "invalid response '%s' to command '%s'",
- buffer, config.commands[counter]);
+ mopl_utils_xasprintf(&sc_expected_responses.output,
+ "invalid response '%s' to command '%s'", buffer,
+ config.commands[counter]);
} else {
regerror(excode, &preg, errbuf, MAX_INPUT_BUFFER);
- mopl_utils_xasprintf(&sc_expected_responses.output, "regexec execute error: %s", errbuf);
+ mopl_utils_xasprintf(&sc_expected_responses.output, "regexec execute error: %s",
+ errbuf);
sc_expected_responses = mp_set_subcheck_state(sc_expected_responses, STATE_UNKNOWN);
}
@@ -510,7 +518,8 @@ int main(int argc, char **argv) {
}
if (strncmp(buffer, "334", 3) != 0) {
- mopl_utils_xasprintf(&sc_auth.output, "invalid response received after AUTH LOGIN");
+ mopl_utils_xasprintf(&sc_auth.output,
+ "invalid response received after AUTH LOGIN");
sc_auth = mp_set_subcheck_state(sc_auth, STATE_CRITICAL);
break;
}
@@ -535,7 +544,8 @@ int main(int argc, char **argv) {
}
if (strncmp(buffer, "334", 3) != 0) {
- mopl_utils_xasprintf(&sc_auth.output, "invalid response received after authuser");
+ mopl_utils_xasprintf(&sc_auth.output,
+ "invalid response received after authuser");
sc_auth = mp_set_subcheck_state(sc_auth, STATE_CRITICAL);
break;
}
@@ -561,7 +571,8 @@ int main(int argc, char **argv) {
}
if (strncmp(buffer, "235", 3) != 0) {
- mopl_utils_xasprintf(&sc_auth.output, "invalid response received after authpass");
+ mopl_utils_xasprintf(&sc_auth.output,
+ "invalid response received after authpass");
sc_auth = mp_set_subcheck_state(sc_auth, STATE_CRITICAL);
break;
}
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index e2f324b8..84ee821f 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -305,8 +305,8 @@ int main(int argc, char **argv) {
} else if (response.number_of_results != config.snmp_params.num_of_test_units) {
mp_subcheck sc_strange_query_result = mp_subcheck_init();
mopl_utils_xasprintf(&sc_strange_query_result.output,
- "SNMP query returned %zu results, but %zu were requested",
- response.number_of_results, config.snmp_params.num_of_test_units);
+ "SNMP query returned %zu results, but %zu were requested",
+ response.number_of_results, config.snmp_params.num_of_test_units);
sc_strange_query_result = mp_set_subcheck_state(sc_strange_query_result, STATE_UNKNOWN);
mp_add_subcheck_to_check(&overall, sc_strange_query_result);
mp_exit(overall);
@@ -382,7 +382,8 @@ int main(int argc, char **argv) {
gen_state_string(new_state, config.snmp_params.num_of_test_units);
if (current_state_wrapper.errorcode == OK) {
- check_snmp_state_write_string(stateKey, current_time, current_state_wrapper.state_string);
+ check_snmp_state_write_string(stateKey, current_time,
+ current_state_wrapper.state_string);
} else {
die(STATE_UNKNOWN, "failed to create state string");
}
@@ -875,7 +876,7 @@ static process_arguments_wrapper process_arguments(int argc, char **argv) {
} else if (strcasecmp(connection_prefix, "tcp") == 0) {
// use tcp/ipv4
mopl_utils_xasprintf(&config.snmp_params.snmp_session.peername, "tcp:%s",
- config.snmp_params.snmp_session.peername);
+ config.snmp_params.snmp_session.peername);
} else if (strcasecmp(connection_prefix, "tcp6") == 0 ||
strcasecmp(connection_prefix, "tcpv6") == 0 ||
strcasecmp(connection_prefix, "tcpipv6") == 0 ||
@@ -884,23 +885,23 @@ static process_arguments_wrapper process_arguments(int argc, char **argv) {
strcasecmp(connection_prefix, "udpv6") == 0) {
// Man page (or net-snmp) code says IPv6 addresses should be wrapped in [], but it
// works anyway therefore do nothing here
- mopl_utils_xasprintf(&config.snmp_params.snmp_session.peername, "%s:%s", connection_prefix,
- config.snmp_params.snmp_session.peername);
+ mopl_utils_xasprintf(&config.snmp_params.snmp_session.peername, "%s:%s",
+ connection_prefix, config.snmp_params.snmp_session.peername);
} else if (strcmp(connection_prefix, "tls") == 0) {
// TODO: Anything else to do here?
mopl_utils_xasprintf(&config.snmp_params.snmp_session.peername, "tls:%s",
- config.snmp_params.snmp_session.peername);
+ config.snmp_params.snmp_session.peername);
} else if (strcmp(connection_prefix, "dtls") == 0) {
// TODO: Anything else to do here?
mopl_utils_xasprintf(&config.snmp_params.snmp_session.peername, "dtls:%s",
- config.snmp_params.snmp_session.peername);
+ config.snmp_params.snmp_session.peername);
} else if (strcmp(connection_prefix, "unix") == 0) {
// TODO: Check whether this is a valid path?
mopl_utils_xasprintf(&config.snmp_params.snmp_session.peername, "unix:%s",
- config.snmp_params.snmp_session.peername);
+ config.snmp_params.snmp_session.peername);
} else if (strcmp(connection_prefix, "ipx") == 0) {
mopl_utils_xasprintf(&config.snmp_params.snmp_session.peername, "ipx:%s",
- config.snmp_params.snmp_session.peername);
+ config.snmp_params.snmp_session.peername);
} else {
// Don't know that prefix, die here
die(STATE_UNKNOWN, "Unknown connection prefix");
@@ -914,7 +915,7 @@ static process_arguments_wrapper process_arguments(int argc, char **argv) {
if (port != NULL) {
mopl_utils_xasprintf(&config.snmp_params.snmp_session.peername, "%s:%s",
- config.snmp_params.snmp_session.peername, port);
+ config.snmp_params.snmp_session.peername, port);
}
/* check whether to load locally installed MIBS (CPU/disk intensive) */
@@ -1110,7 +1111,8 @@ void print_help(void) {
printf(" %s\n", _("3 = UNKNOWN"));
printf(" %s\n", "--missing-oid=#");
printf(" %s\n", _("If a query for an OID returns nothing (OID missing on the target)"));
- printf(" %s\n", _("this option allows you to choose what status you want for this specific OID"));
+ printf(" %s\n",
+ _("this option allows you to choose what status you want for this specific OID"));
printf(" %s\n", _("Excluding this option renders the default exit of 2 (CRITICAL)"));
printf(" %s\n", _("0 = OK"));
printf(" %s\n", _("1 = WARNING"));
diff --git a/plugins/check_snmp.d/check_snmp_helpers.c b/plugins/check_snmp.d/check_snmp_helpers.c
index b24569ef..d6a8c1a5 100644
--- a/plugins/check_snmp.d/check_snmp_helpers.c
+++ b/plugins/check_snmp.d/check_snmp_helpers.c
@@ -269,14 +269,16 @@ snmp_responces do_snmp_query(check_snmp_config_snmp_parameters parameters) {
if (verbose) {
printf("Debug: Got a float\n");
}
- result.response_values[result.number_of_results].value.doubleVal = *(vars->val.floatVal);
+ result.response_values[result.number_of_results].value.doubleVal =
+ *(vars->val.floatVal);
result.response_values[result.number_of_results].type = vars->type;
} break;
case ASN_DOUBLE: {
if (verbose) {
printf("Debug: Got a double\n");
}
- result.response_values[result.number_of_results].value.doubleVal = *(vars->val.doubleVal);
+ result.response_values[result.number_of_results].value.doubleVal =
+ *(vars->val.doubleVal);
result.response_values[result.number_of_results].type = vars->type;
} break;
case ASN_IPADDRESS:
@@ -345,7 +347,8 @@ check_snmp_evaluation evaluate_single_unit(response_value response,
if (query_timestamp == prev_state.timestamp) {
// somehow we have the same timestamp again, that can't be good
sc_oid_test = mp_set_subcheck_state(sc_oid_test, STATE_UNKNOWN);
- mopl_utils_xasprintf(&sc_oid_test.output, "Time duration between plugin calls is invalid");
+ mopl_utils_xasprintf(&sc_oid_test.output,
+ "Time duration between plugin calls is invalid");
check_snmp_evaluation result = {
.sc = sc_oid_test,
@@ -375,14 +378,17 @@ check_snmp_evaluation evaluate_single_unit(response_value response,
if (strchr(tmp, '\'') != NULL) {
// got single quote in the string too
// dont quote that at all to avoid even more confusion
- mopl_utils_xasprintf(&sc_oid_test.output, "%s - Value: %s", sc_oid_test.output, tmp);
+ mopl_utils_xasprintf(&sc_oid_test.output, "%s - Value: %s", sc_oid_test.output,
+ tmp);
} else {
// quote with single quotes
- mopl_utils_xasprintf(&sc_oid_test.output, "%s - Value: '%s'", sc_oid_test.output, tmp);
+ mopl_utils_xasprintf(&sc_oid_test.output, "%s - Value: '%s'", sc_oid_test.output,
+ tmp);
}
} else {
// quote with double quotes
- mopl_utils_xasprintf(&sc_oid_test.output, "%s - Value: \"%s\"", sc_oid_test.output, tmp);
+ mopl_utils_xasprintf(&sc_oid_test.output, "%s - Value: \"%s\"", sc_oid_test.output,
+ tmp);
}
if (strlen(tmp) == 0) {
@@ -576,10 +582,11 @@ check_snmp_evaluation evaluate_single_unit(response_value response,
pd_num_val.value = pd_result_val;
mopl_utils_xasprintf(&sc_oid_test.output, "%s Value: %s", sc_oid_test.output,
- pd_value_to_string(pd_result_val));
+ pd_value_to_string(pd_result_val));
if (test_unit.unit_value != NULL && strcmp(test_unit.unit_value, "") != 0) {
- mopl_utils_xasprintf(&sc_oid_test.output, "%s%s", sc_oid_test.output, test_unit.unit_value);
+ mopl_utils_xasprintf(&sc_oid_test.output, "%s%s", sc_oid_test.output,
+ test_unit.unit_value);
}
if (test_unit.threshold.warning_is_set || test_unit.threshold.critical_is_set) {
@@ -588,12 +595,14 @@ check_snmp_evaluation evaluate_single_unit(response_value response,
if (tmp_state == STATE_WARNING) {
sc_oid_test = mp_set_subcheck_state(sc_oid_test, STATE_WARNING);
- mopl_utils_xasprintf(&sc_oid_test.output, "%s - number violates warning threshold",
- sc_oid_test.output);
+ mopl_utils_xasprintf(&sc_oid_test.output,
+ "%s - number violates warning threshold",
+ sc_oid_test.output);
} else if (tmp_state == STATE_CRITICAL) {
sc_oid_test = mp_set_subcheck_state(sc_oid_test, STATE_CRITICAL);
- mopl_utils_xasprintf(&sc_oid_test.output, "%s - number violates critical threshold",
- sc_oid_test.output);
+ mopl_utils_xasprintf(&sc_oid_test.output,
+ "%s - number violates critical threshold",
+ sc_oid_test.output);
}
}
@@ -602,8 +611,9 @@ check_snmp_evaluation evaluate_single_unit(response_value response,
// should calculate rate, but there is no previous state, so first run
// exit with ok now
sc_oid_test = mp_set_subcheck_state(sc_oid_test, STATE_OK);
- mopl_utils_xasprintf(&sc_oid_test.output, "%s - No previous data to calculate rate - assume okay",
- sc_oid_test.output);
+ mopl_utils_xasprintf(&sc_oid_test.output,
+ "%s - No previous data to calculate rate - assume okay",
+ sc_oid_test.output);
}
}
@@ -730,7 +740,8 @@ typedef struct {
int errorcode;
state_data data;
} check_snmp_state_read_file_wrapper;
-check_snmp_state_read_file_wrapper check_snmp_state_read_file(FILE *state_file, state_key input_state) {
+check_snmp_state_read_file_wrapper check_snmp_state_read_file(FILE *state_file,
+ state_key input_state) {
time_t current_time;
time(¤t_time);
@@ -912,8 +923,9 @@ state_key check_snmp_enable_state(char *keyname, int expected_data_version, cons
/* Calculate filename */
char *temp_filename = NULL;
- int error = asprintf(&temp_filename, "%s/%lu/%s/%s", check_snmp_state_calculate_location_prefix(),
- (unsigned long)geteuid(), plugin_name, this_state->name);
+ int error =
+ asprintf(&temp_filename, "%s/%lu/%s/%s", check_snmp_state_calculate_location_prefix(),
+ (unsigned long)geteuid(), plugin_name, this_state->name);
if (error < 0) {
die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), strerror(errno));
}
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index 3119492a..0d7bc64c 100644
--- a/plugins/check_ssh.c
+++ b/plugins/check_ssh.c
@@ -253,7 +253,8 @@ int ssh_connect(mp_check *overall, char *haddr, int hport, char *desired_remote_
if (result != STATE_OK) {
connection_sc = mp_set_subcheck_state(connection_sc, STATE_CRITICAL);
mopl_utils_xasprintf(&connection_sc.output,
- "Failed to establish TCP connection to Host %s and Port %d", haddr, hport);
+ "Failed to establish TCP connection to Host %s and Port %d", haddr,
+ hport);
mp_add_subcheck_to_check(overall, connection_sc);
return result;
}
@@ -312,7 +313,8 @@ int ssh_connect(mp_check *overall, char *haddr, int hport, char *desired_remote_
if (version_control_string == NULL) {
connection_sc = mp_set_subcheck_state(connection_sc, STATE_CRITICAL);
- mopl_utils_xasprintf(&connection_sc.output, "%s", "SSH CRITICAL - No version control string received");
+ mopl_utils_xasprintf(&connection_sc.output, "%s",
+ "SSH CRITICAL - No version control string received");
mp_add_subcheck_to_check(overall, connection_sc);
return OK;
}
@@ -364,15 +366,15 @@ int ssh_connect(mp_check *overall, char *haddr, int hport, char *desired_remote_
mp_subcheck protocol_validity_sc = mp_subcheck_init();
if (strlen(ssh_proto) == 0 || strlen(ssh_server) == 0) {
protocol_validity_sc = mp_set_subcheck_state(protocol_validity_sc, STATE_CRITICAL);
- mopl_utils_xasprintf(&protocol_validity_sc.output, "Invalid protocol version control string %s",
- version_control_string);
+ mopl_utils_xasprintf(&protocol_validity_sc.output,
+ "Invalid protocol version control string %s", version_control_string);
mp_add_subcheck_to_check(overall, protocol_validity_sc);
return OK;
}
protocol_validity_sc = mp_set_subcheck_state(protocol_validity_sc, STATE_OK);
mopl_utils_xasprintf(&protocol_validity_sc.output, "Valid protocol version control string %s",
- version_control_string);
+ version_control_string);
mp_add_subcheck_to_check(overall, protocol_validity_sc);
ssh_proto[strspn(ssh_proto, "0123456789. ")] = 0;
@@ -387,8 +389,9 @@ int ssh_connect(mp_check *overall, char *haddr, int hport, char *desired_remote_
if (desired_remote_version && strcmp(desired_remote_version, ssh_server)) {
mp_subcheck remote_version_sc = mp_subcheck_init();
remote_version_sc = mp_set_subcheck_state(remote_version_sc, STATE_CRITICAL);
- mopl_utils_xasprintf(&remote_version_sc.output, _("%s (protocol %s) version mismatch, expected '%s'"),
- ssh_server, ssh_proto, desired_remote_version);
+ mopl_utils_xasprintf(&remote_version_sc.output,
+ _("%s (protocol %s) version mismatch, expected '%s'"), ssh_server,
+ ssh_proto, desired_remote_version);
close(socket);
mp_add_subcheck_to_check(overall, remote_version_sc);
return OK;
@@ -407,12 +410,13 @@ int ssh_connect(mp_check *overall, char *haddr, int hport, char *desired_remote_
if (desired_remote_protocol && strcmp(desired_remote_protocol, ssh_proto)) {
protocol_version_sc = mp_set_subcheck_state(protocol_version_sc, STATE_CRITICAL);
mopl_utils_xasprintf(&protocol_version_sc.output,
- _("%s (protocol %s) protocol version mismatch, expected '%s'"), ssh_server,
- ssh_proto, desired_remote_protocol);
+ _("%s (protocol %s) protocol version mismatch, expected '%s'"),
+ ssh_server, ssh_proto, desired_remote_protocol);
} else {
protocol_version_sc = mp_set_subcheck_state(protocol_version_sc, STATE_OK);
- mopl_utils_xasprintf(&protocol_version_sc.output, "SSH server version: %s (protocol version: %s)",
- ssh_server, ssh_proto);
+ mopl_utils_xasprintf(&protocol_version_sc.output,
+ "SSH server version: %s (protocol version: %s)", ssh_server,
+ ssh_proto);
}
mp_add_subcheck_to_check(overall, protocol_version_sc);
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index df48c324..7fdffc6f 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -207,7 +207,7 @@ int main(int argc, char **argv) {
}
mopl_utils_xasprintf(&sc1.output, _("%g%% free (%lluMiB out of %lluMiB)"), (100 - percent_used),
- data.metrics.free >> 20, data.metrics.total >> 20);
+ data.metrics.free >> 20, data.metrics.total >> 20);
overall.summary = "Swap";
mp_add_subcheck_to_check(&overall, sc1);
@@ -301,7 +301,7 @@ swap_config_wrapper process_arguments(int argc, char **argv) {
break;
}
mopl_utils_usage4(_("Warning threshold be positive integer or "
- "percentage!"));
+ "percentage!"));
}
case 'c': /* critical size threshold */
{
@@ -331,7 +331,7 @@ swap_config_wrapper process_arguments(int argc, char **argv) {
break;
}
mopl_utils_usage4(_("Critical threshold be positive integer or "
- "percentage!"));
+ "percentage!"));
}
case 'a': /* all swap */
conf_wrapper.config.allswaps = true;
@@ -339,7 +339,7 @@ swap_config_wrapper process_arguments(int argc, char **argv) {
case 'n':
if ((conf_wrapper.config.no_swap_state = mp_translate_state(optarg)) == ERROR) {
mopl_utils_usage4(_("no-swap result must be a valid state name (OK, "
- "WARNING, CRITICAL, UNKNOWN) or integer (0-3)."));
+ "WARNING, CRITICAL, UNKNOWN) or integer (0-3)."));
}
break;
case 'v': /* verbose */
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 909648e4..3315dcac 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -264,18 +264,20 @@ int main(int argc, char **argv) {
// Try initial connection
if (mopl_net_connect(config.server_address, config.server_port, &socket_descriptor,
- config.protocol) == STATE_CRITICAL) {
+ config.protocol) == STATE_CRITICAL) {
// Early exit here, we got connection refused
inital_connect_result =
mp_set_subcheck_state(inital_connect_result, config.econn_refuse_state);
- mopl_utils_xasprintf(&inital_connect_result.output, "Connection to %s on port %i was REFUSED",
- config.server_address, config.server_port);
+ mopl_utils_xasprintf(&inital_connect_result.output,
+ "Connection to %s on port %i was REFUSED", config.server_address,
+ config.server_port);
mp_add_subcheck_to_check(&overall, inital_connect_result);
mp_exit(overall);
} else {
inital_connect_result = mp_set_subcheck_state(inital_connect_result, STATE_OK);
- mopl_utils_xasprintf(&inital_connect_result.output, "Connection to %s on port %i was a SUCCESS",
- config.server_address, config.server_port);
+ mopl_utils_xasprintf(&inital_connect_result.output,
+ "Connection to %s on port %i was a SUCCESS", config.server_address,
+ config.server_port);
mp_add_subcheck_to_check(&overall, inital_connect_result);
}
@@ -299,18 +301,19 @@ int main(int argc, char **argv) {
if (result == STATE_OK) {
mopl_utils_xasprintf(&tls_certificate_lifetime_result.output,
- "Certificate lifetime is within thresholds");
+ "Certificate lifetime is within thresholds");
} else if (result == STATE_WARNING) {
mopl_utils_xasprintf(&tls_certificate_lifetime_result.output,
- "Certificate lifetime is violating warning threshold (%i)",
- config.days_till_exp_warn);
+ "Certificate lifetime is violating warning threshold (%i)",
+ config.days_till_exp_warn);
} else if (result == STATE_CRITICAL) {
- mopl_utils_xasprintf(&tls_certificate_lifetime_result.output,
- "Certificate lifetime is violating critical threshold (%i)",
- config.days_till_exp_crit);
+ mopl_utils_xasprintf(
+ &tls_certificate_lifetime_result.output,
+ "Certificate lifetime is violating critical threshold (%i)",
+ config.days_till_exp_crit);
} else {
mopl_utils_xasprintf(&tls_certificate_lifetime_result.output,
- "Certificate lifetime is somehow unknown");
+ "Certificate lifetime is somehow unknown");
}
mp_add_subcheck_to_subcheck(&tls_connection_result,
@@ -408,7 +411,8 @@ int main(int argc, char **argv) {
/* no data when expected, so return critical */
if (len == 0) {
- mopl_utils_xasprintf(&expected_data_result.output, "Received no data when some was expected");
+ mopl_utils_xasprintf(&expected_data_result.output,
+ "Received no data when some was expected");
expected_data_result = mp_set_subcheck_state(expected_data_result, STATE_CRITICAL);
mp_add_subcheck_to_check(&overall, expected_data_result);
mp_exit(overall);
@@ -448,8 +452,8 @@ int main(int argc, char **argv) {
if (config.critical_time_set && elapsed_time > config.critical_time) {
mopl_utils_xasprintf(&elapsed_time_result.output,
- "Connection time %fs exceeded critical threshold (%f)", elapsed_time,
- config.critical_time);
+ "Connection time %fs exceeded critical threshold (%f)", elapsed_time,
+ config.critical_time);
elapsed_time_result = mp_set_subcheck_state(elapsed_time_result, STATE_CRITICAL);
time_pd.crit_present = true;
@@ -461,8 +465,8 @@ int main(int argc, char **argv) {
time_pd.crit = crit_val;
} else if (config.warning_time_set && elapsed_time > config.warning_time) {
mopl_utils_xasprintf(&elapsed_time_result.output,
- "Connection time %fs exceeded warning threshold (%f)", elapsed_time,
- config.critical_time);
+ "Connection time %fs exceeded warning threshold (%f)", elapsed_time,
+ config.critical_time);
elapsed_time_result = mp_set_subcheck_state(elapsed_time_result, STATE_WARNING);
time_pd.warn_present = true;
@@ -473,8 +477,8 @@ int main(int argc, char **argv) {
time_pd.warn = warn_val;
} else {
elapsed_time_result = mp_set_subcheck_state(elapsed_time_result, STATE_OK);
- mopl_utils_xasprintf(&elapsed_time_result.output, "Connection time %fs is within thresholds",
- elapsed_time);
+ mopl_utils_xasprintf(&elapsed_time_result.output,
+ "Connection time %fs is within thresholds", elapsed_time);
}
mp_add_perfdata_to_subcheck(&elapsed_time_result, time_pd);
@@ -488,7 +492,8 @@ int main(int argc, char **argv) {
mp_add_subcheck_to_check(&overall, expected_data_result);
} else if (match == NP_MATCH_SUCCESS) {
expected_data_result = mp_set_subcheck_state(expected_data_result, STATE_OK);
- mopl_utils_xasprintf(&expected_data_result.output, "The answer of the server matched the expectation");
+ mopl_utils_xasprintf(&expected_data_result.output,
+ "The answer of the server matched the expectation");
mp_add_subcheck_to_check(&overall, expected_data_result);
}
diff --git a/plugins/check_time.c b/plugins/check_time.c
index 765d1105..5ae8b499 100644
--- a/plugins/check_time.c
+++ b/plugins/check_time.c
@@ -143,8 +143,8 @@ int main(int argc, char **argv) {
if (result != STATE_OK) {
die(result, _("TIME %s - %d second response time|%s\n"), state_text(result), (int)conntime,
mopl_utils_perfdata("time", (long)conntime, "s", config.check_warning_time,
- (long)config.warning_time, config.check_critical_time,
- (long)config.critical_time, true, 0, false, 0));
+ (long)config.warning_time, config.check_critical_time,
+ (long)config.critical_time, true, 0, false, 0));
}
unsigned long server_time;
@@ -164,10 +164,11 @@ int main(int argc, char **argv) {
printf(_("TIME %s - %lu second time difference|%s %s\n"), state_text(result), diff_time,
mopl_utils_perfdata("time", (long)conntime, "s", config.check_warning_time,
- (long)config.warning_time, config.check_critical_time,
- (long)config.critical_time, true, 0, false, 0),
- mopl_utils_perfdata("offset", diff_time, "s", config.check_warning_diff, config.warning_diff,
- config.check_critical_diff, config.critical_diff, true, 0, false, 0));
+ (long)config.warning_time, config.check_critical_time,
+ (long)config.critical_time, true, 0, false, 0),
+ mopl_utils_perfdata("offset", diff_time, "s", config.check_warning_diff,
+ config.warning_diff, config.check_critical_diff,
+ config.critical_diff, true, 0, false, 0));
return result;
}
diff --git a/plugins/check_ups.c b/plugins/check_ups.c
index ba561236..a40c8a2b 100644
--- a/plugins/check_ups.c
+++ b/plugins/check_ups.c
@@ -100,7 +100,8 @@ int main(int argc, char **argv) {
determine_status_result query_result = determine_status(config);
if (query_result.errorcode != OK) {
sc_retrieve_status = mp_set_subcheck_state(sc_retrieve_status, STATE_CRITICAL);
- mopl_utils_xasprintf(&sc_retrieve_status.output, "%s", "Failed to retrieve status from UPS tools");
+ mopl_utils_xasprintf(&sc_retrieve_status.output, "%s",
+ "Failed to retrieve status from UPS tools");
mp_add_subcheck_to_check(&overall, sc_retrieve_status);
mp_exit(overall);
}
@@ -127,52 +128,64 @@ int main(int argc, char **argv) {
ups_state_result = STATE_CRITICAL;
} else {
if (ups_status_flags & UPSSTATUS_OL) {
- mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output, _("Online"));
+ mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output,
+ _("Online"));
}
if (ups_status_flags & UPSSTATUS_OB) {
- mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output, _("On Battery"));
+ mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output,
+ _("On Battery"));
ups_state_result = max_state(ups_state_result, STATE_WARNING);
}
if (ups_status_flags & UPSSTATUS_LB) {
- mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output, _(", Low Battery"));
+ mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output,
+ _(", Low Battery"));
ups_state_result = max_state(ups_state_result, STATE_WARNING);
}
if (ups_status_flags & UPSSTATUS_CAL) {
- mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output, _(", Calibrating"));
+ mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output,
+ _(", Calibrating"));
}
if (ups_status_flags & UPSSTATUS_RB) {
mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output,
- _(", Replace Battery"));
+ _(", Replace Battery"));
ups_state_result = max_state(ups_state_result, STATE_WARNING);
}
if (ups_status_flags & UPSSTATUS_BYPASS) {
- mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output, _(", On Bypass"));
+ mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output,
+ _(", On Bypass"));
// Bypassing the battery is likely a bad thing
ups_state_result = STATE_CRITICAL;
}
if (ups_status_flags & UPSSTATUS_OVER) {
- mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output, _(", Overload"));
+ mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output,
+ _(", Overload"));
ups_state_result = max_state(ups_state_result, STATE_WARNING);
}
if (ups_status_flags & UPSSTATUS_TRIM) {
- mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output, _(", Trimming"));
+ mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output,
+ _(", Trimming"));
}
if (ups_status_flags & UPSSTATUS_BOOST) {
- mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output, _(", Boosting"));
+ mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output,
+ _(", Boosting"));
}
if (ups_status_flags & UPSSTATUS_CHRG) {
- mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output, _(", Charging"));
+ mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output,
+ _(", Charging"));
}
if (ups_status_flags & UPSSTATUS_DISCHRG) {
- mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output, _(", Discharging"));
+ mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output,
+ _(", Discharging"));
ups_state_result = max_state(ups_state_result, STATE_WARNING);
}
if (ups_status_flags & UPSSTATUS_ALARM) {
- mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output, _(", ALARM"));
+ mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output,
+ _(", ALARM"));
ups_state_result = STATE_CRITICAL;
}
if (ups_status_flags & UPSSTATUS_UNKNOWN) {
- mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output, _(", Unknown"));
+ mopl_utils_xasprintf(&sc_ups_status.output, "%s%s", sc_ups_status.output,
+ _(", Unknown"));
}
}
mopl_utils_xasprintf(&sc_ups_status.output, "Status: %s", sc_ups_status.output);
@@ -240,7 +253,8 @@ int main(int argc, char **argv) {
supported_options |= UPS_BATTPCT;
double ups_battery_percent = atof(temp_buffer);
- mopl_utils_xasprintf(&sc_battery_charge.output, "Battery charge: %3.1f%%", ups_battery_percent);
+ mopl_utils_xasprintf(&sc_battery_charge.output, "Battery charge: %3.1f%%",
+ ups_battery_percent);
mp_perfdata pd_battery_charge = perfdata_init();
pd_battery_charge = mp_set_pd_value(pd_battery_charge, ups_battery_percent);
@@ -362,7 +376,8 @@ int main(int argc, char **argv) {
if (supported_options == UPS_NONE) {
mp_subcheck sc_any_option = mp_subcheck_init();
sc_any_option = mp_set_subcheck_state(sc_any_option, STATE_CRITICAL);
- mopl_utils_xasprintf(&sc_any_option.output, _("UPS does not support any available options\n"));
+ mopl_utils_xasprintf(&sc_any_option.output,
+ _("UPS does not support any available options\n"));
mp_add_subcheck_to_check(&overall, sc_any_option);
}
@@ -449,8 +464,8 @@ int get_ups_variable(const char *varname, char *buf, const check_ups_config conf
char temp_buffer[MAX_INPUT_BUFFER];
/* send the command to the daemon and get a response back */
- if (mopl_net_process_tcp_request(config.server_address, config.server_port, send_buffer, temp_buffer,
- sizeof(temp_buffer)) != STATE_OK) {
+ if (mopl_net_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;
}
@@ -576,7 +591,8 @@ check_ups_config_wrapper process_arguments(int argc, char **argv) {
if (mopl_utils_is_intnonneg(optarg)) {
mp_range_parsed tmp = mp_parse_range_string(optarg);
if (tmp.error != MP_PARSING_SUCCESS) {
- mopl_utils_usage2(_("Critical voltage must be a valid range expression"), optarg);
+ mopl_utils_usage2(_("Critical voltage must be a valid range expression"),
+ optarg);
} else {
tmp_thr = mp_thresholds_set_crit(tmp_thr, tmp.range);
}
@@ -588,7 +604,8 @@ check_ups_config_wrapper process_arguments(int argc, char **argv) {
if (mopl_utils_is_intnonneg(optarg)) {
mp_range_parsed tmp = mp_parse_range_string(optarg);
if (tmp.error != MP_PARSING_SUCCESS) {
- mopl_utils_usage2(_("Warning voltage must be a valid range expression"), optarg);
+ mopl_utils_usage2(_("Warning voltage must be a valid range expression"),
+ optarg);
} else {
tmp_thr = mp_thresholds_set_warn(tmp_thr, tmp.range);
}
diff --git a/plugins/check_users.c b/plugins/check_users.c
index 5b5c84b2..db629946 100644
--- a/plugins/check_users.c
+++ b/plugins/check_users.c
@@ -132,13 +132,13 @@ int main(int argc, char **argv) {
switch (tmp_status) {
case STATE_WARNING:
mopl_utils_xasprintf(&sc_users.output,
- "%d users currently logged in. This violates the warning threshold",
- user_wrapper.users);
+ "%d users currently logged in. This violates the warning threshold",
+ user_wrapper.users);
break;
case STATE_CRITICAL:
mopl_utils_xasprintf(&sc_users.output,
- "%d users currently logged in. This violates the critical threshold",
- user_wrapper.users);
+ "%d users currently logged in. This violates the critical threshold",
+ user_wrapper.users);
break;
default:
mopl_utils_xasprintf(&sc_users.output, "%d users currently logged in", user_wrapper.users);
diff --git a/plugins/negate.c b/plugins/negate.c
index 97d1aca8..d043f9c9 100644
--- a/plugins/negate.c
+++ b/plugins/negate.c
@@ -106,7 +106,7 @@ int main(int argc, char **argv) {
sub += strlen(state_text(result));
/* then put everything back together */
mopl_utils_xasprintf(&chld_out.line[i], "%s%s%s", chld_out.line[i],
- state_text(config.state[result]), sub);
+ state_text(config.state[result]), sub);
}
}
printf("%s\n", chld_out.line[i]);
@@ -161,36 +161,41 @@ static negate_config_wrapper process_arguments(int argc, char **argv) {
break;
case 'T': /* Result to return on timeouts */
if ((timeout_state = mp_translate_state(optarg)) == ERROR) {
- mopl_utils_usage4(_("Timeout result must be a valid state name (OK, WARNING, CRITICAL, "
- "UNKNOWN) or integer (0-3)."));
+ mopl_utils_usage4(
+ _("Timeout result must be a valid state name (OK, WARNING, CRITICAL, "
+ "UNKNOWN) or integer (0-3)."));
}
break;
case 'o': /* replacement for OK */
if ((result.config.state[STATE_OK] = mp_translate_state(optarg)) == ERROR) {
- mopl_utils_usage4(_("Ok must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or "
- "integer (0-3)."));
+ mopl_utils_usage4(
+ _("Ok must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or "
+ "integer (0-3)."));
}
permute = false;
break;
case 'w': /* replacement for WARNING */
if ((result.config.state[STATE_WARNING] = mp_translate_state(optarg)) == ERROR) {
- mopl_utils_usage4(_("Warning must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or "
- "integer (0-3)."));
+ mopl_utils_usage4(
+ _("Warning must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or "
+ "integer (0-3)."));
}
permute = false;
break;
case 'c': /* replacement for CRITICAL */
if ((result.config.state[STATE_CRITICAL] = mp_translate_state(optarg)) == ERROR) {
- mopl_utils_usage4(_("Critical must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or "
- "integer (0-3)."));
+ mopl_utils_usage4(
+ _("Critical must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or "
+ "integer (0-3)."));
}
permute = false;
break;
case 'u': /* replacement for UNKNOWN */
if ((result.config.state[STATE_UNKNOWN] = mp_translate_state(optarg)) == ERROR) {
- mopl_utils_usage4(_("Unknown must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or "
- "integer (0-3)."));
+ mopl_utils_usage4(
+ _("Unknown must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or "
+ "integer (0-3)."));
}
permute = false;
break;
diff --git a/plugins/netutils.c b/plugins/netutils.c
index 6b97cecc..8eb76e81 100644
--- a/plugins/netutils.c
+++ b/plugins/netutils.c
@@ -52,9 +52,11 @@ void mopl_net_socket_timeout_alarm_handler(int sig) {
timeout_sc = mp_set_subcheck_state(timeout_sc, socket_timeout_state);
if (sig == SIGALRM) {
- mopl_utils_xasprintf(&timeout_sc.output, _("Socket timeout after %d seconds"), socket_timeout);
+ mopl_utils_xasprintf(&timeout_sc.output, _("Socket timeout after %d seconds"),
+ socket_timeout);
} else {
- mopl_utils_xasprintf(&timeout_sc.output, _("Abnormal timeout after %d seconds"), socket_timeout);
+ mopl_utils_xasprintf(&timeout_sc.output, _("Abnormal timeout after %d seconds"),
+ socket_timeout);
}
mp_check overall = mp_check_init();
diff --git a/plugins/netutils.h b/plugins/netutils.h
index 650aa81b..3a3758d3 100644
--- a/plugins/netutils.h
+++ b/plugins/netutils.h
@@ -95,9 +95,11 @@ typedef enum {
int mopl_net_tls_init(int socket);
int mopl_net_tls_init_with_hostname(int socket, char *host_name);
-int mopl_net_tls_init_with_hostname_and_version(int socket, char *host_name, mopl_tls_version version);
-int mopl_net_tls_init_with_hostname_version_and_cert(int socket, char *host_name, mopl_tls_version version,
- char *cert, char *privkey);
+int mopl_net_tls_init_with_hostname_and_version(int socket, char *host_name,
+ mopl_tls_version version);
+int mopl_net_tls_init_with_hostname_version_and_cert(int socket, char *host_name,
+ mopl_tls_version version, char *cert,
+ char *privkey);
void mopl_net_tls_cleanup(void);
int mopl_net_ssl_write(const void *buf, int num);
int mopl_net_ssl_read(void *buf, int num);
diff --git a/plugins/sslutils.c b/plugins/sslutils.c
index 757a83c8..549e31ab 100644
--- a/plugins/sslutils.c
+++ b/plugins/sslutils.c
@@ -40,7 +40,8 @@ static SSL *SSL_context = NULL;
int mopl_net_tls_init(int socket) { return mopl_net_tls_init_with_hostname(socket, NULL); }
int mopl_net_tls_init_with_hostname(int socket, char *host_name) {
- return mopl_net_tls_init_with_hostname_and_version(socket, host_name, MOPL_NET_TLS_DEFAULT_VERSION);
+ return mopl_net_tls_init_with_hostname_and_version(socket, host_name,
+ MOPL_NET_TLS_DEFAULT_VERSION);
}
int mopl_net_tls_init_with_hostname_and_version(int socket, char *host_name,
@@ -159,7 +160,7 @@ int mopl_net_tls_init_with_hostname_version_and_cert(int socket, char *host_name
break;
# endif
case MOPL_NET_TLS_DEFAULT_VERSION: {
- // do nothing special here
+ // do nothing special here
}
}
@@ -443,8 +444,8 @@ mp_subcheck mp_net_ssl_check_certificate(X509 *certificate, int days_till_exp_wa
int time_remaining;
if (days_left > 0 && days_left <= days_till_exp_warn) {
- mopl_utils_xasprintf(&sc_cert.output, _("Certificate '%s' expires in %d day(s) (%s)"), commonName,
- days_left, timestamp);
+ mopl_utils_xasprintf(&sc_cert.output, _("Certificate '%s' expires in %d day(s) (%s)"),
+ commonName, days_left, timestamp);
if (days_left > days_till_exp_crit) {
sc_cert = mp_set_subcheck_state(sc_cert, STATE_WARNING);
} else {
@@ -457,8 +458,9 @@ mp_subcheck mp_net_ssl_check_certificate(X509 *certificate, int days_till_exp_wa
time_remaining = (int)time_left / 60;
}
- mopl_utils_xasprintf(&sc_cert.output, _("Certificate '%s' expires in %u %s (%s)"), commonName,
- time_remaining, time_left >= 3600 ? "hours" : "minutes", timestamp);
+ mopl_utils_xasprintf(&sc_cert.output, _("Certificate '%s' expires in %u %s (%s)"),
+ commonName, time_remaining, time_left >= 3600 ? "hours" : "minutes",
+ timestamp);
if (days_left > days_till_exp_crit) {
sc_cert = mp_set_subcheck_state(sc_cert, STATE_WARNING);
@@ -466,17 +468,20 @@ mp_subcheck mp_net_ssl_check_certificate(X509 *certificate, int days_till_exp_wa
sc_cert = mp_set_subcheck_state(sc_cert, STATE_CRITICAL);
}
} else if (time_left < 0) {
- mopl_utils_xasprintf(&sc_cert.output, _("Certificate '%s' expired on %s"), commonName, timestamp);
+ mopl_utils_xasprintf(&sc_cert.output, _("Certificate '%s' expired on %s"), commonName,
+ timestamp);
sc_cert = mp_set_subcheck_state(sc_cert, STATE_CRITICAL);
} else if (days_left == 0) {
- mopl_utils_xasprintf(&sc_cert.output, _("Certificate '%s' just expired (%s)"), commonName, timestamp);
+ mopl_utils_xasprintf(&sc_cert.output, _("Certificate '%s' just expired (%s)"), commonName,
+ timestamp);
if (days_left > days_till_exp_crit) {
sc_cert = mp_set_subcheck_state(sc_cert, STATE_WARNING);
} else {
sc_cert = mp_set_subcheck_state(sc_cert, STATE_CRITICAL);
}
} else {
- mopl_utils_xasprintf(&sc_cert.output, _("Certificate '%s' will expire on %s"), commonName, timestamp);
+ mopl_utils_xasprintf(&sc_cert.output, _("Certificate '%s' will expire on %s"), commonName,
+ timestamp);
sc_cert = mp_set_subcheck_state(sc_cert, STATE_OK);
}
X509_free(certificate);
diff --git a/plugins/tests/test_check_snmp.c b/plugins/tests/test_check_snmp.c
index 0d44be70..97a8aeae 100644
--- a/plugins/tests/test_check_snmp.c
+++ b/plugins/tests/test_check_snmp.c
@@ -181,7 +181,7 @@ void test_read_state(state_key test_state, const char test_string[], const char
current_time = 1234567890;
check_snmp_state_write_string(test_state, current_time, test_string);
(void)!asprintf(&cmp_execution_string, "cmp %s %s", generated_dir_test_file_path,
- example_statefile_file_path);
+ example_statefile_file_path);
ok(system(cmp_execution_string) == 0, "Have created directory");
test_state._filename = generated_dir_test_file_path;
@@ -190,7 +190,7 @@ void test_read_state(state_key test_state, const char test_string[], const char
ok(recovered_state_1.errorcode == 0, "recovered state successfully");
/* Check time is set to current_time */
(void)!asprintf(&cmp_execution_string, "cmp %s %s > /dev/null", generated_dir_test_file_path,
- example_statefile_file_path);
+ example_statefile_file_path);
ok(system(cmp_execution_string) != 0, "Generated file should be different this time");
time(¤t_time);
diff --git a/plugins/utils.c b/plugins/utils.c
index 72767a8f..881dd724 100644
--- a/plugins/utils.c
+++ b/plugins/utils.c
@@ -368,8 +368,9 @@ int mopl_utils_xasprintf(char **strp, const char *fmt, ...) {
*
******************************************************************************/
-char *mopl_utils_perfdata(const char *label, long int val, const char *uom, bool warnp, long int warn,
- bool critp, long int crit, bool minp, long int minv, bool maxp, long int maxv) {
+char *mopl_utils_perfdata(const char *label, long int val, const char *uom, bool warnp,
+ long int warn, bool critp, long int crit, bool minp, long int minv,
+ bool maxp, long int maxv) {
char *data = NULL;
if (strpbrk(label, "'= ")) {
@@ -403,8 +404,9 @@ char *mopl_utils_perfdata(const char *label, long int val, const char *uom, bool
return data;
}
-char *mopl_utils_fperfdata(const char *label, double val, const char *uom, bool warnp, double warn, bool critp,
- double crit, bool minp, double minv, bool maxp, double maxv) {
+char *mopl_utils_fperfdata(const char *label, double val, const char *uom, bool warnp, double warn,
+ bool critp, double crit, bool minp, double minv, bool maxp,
+ double maxv) {
char *data = NULL;
if (strpbrk(label, "'= ")) {
diff --git a/plugins/utils.h b/plugins/utils.h
index d82548f7..bc9847b1 100644
--- a/plugins/utils.h
+++ b/plugins/utils.h
@@ -73,16 +73,17 @@ void mopl_utils_usage2(const char *, const char *) __attribute__((noreturn));
void mopl_utils_usage3(const char *, int) __attribute__((noreturn));
void mopl_utils_usage4(const char *) __attribute__((noreturn));
void mopl_utils_usage5(void) __attribute__((noreturn));
-void mopl_utils_usage_va(const char *fmt, ...) __attribute__((noreturn)) __attribute__((format(printf, 1, 2)));
+void mopl_utils_usage_va(const char *fmt, ...) __attribute__((noreturn))
+__attribute__((format(printf, 1, 2)));
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
-char *mopl_utils_perfdata(const char *, long int, const char *, bool, long int, bool, long int, bool, long int,
- bool, long int);
+char *mopl_utils_perfdata(const char *, long int, const char *, bool, long int, bool, long int,
+ bool, long int, bool, long int);
-char *mopl_utils_fperfdata(const char *, double, const char *, bool, double, bool, double, bool, double, bool,
- double);
+char *mopl_utils_fperfdata(const char *, double, const char *, bool, double, bool, double, bool,
+ double, bool, double);
/* The idea here is that, although not every plugin will use all of these,
most will or should. Therefore, for consistency, these very common
More information about the Commits
mailing list