diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-09-15 12:59:37 +0200 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-09-15 12:59:37 +0200 |
| commit | 802e46f8ea36c344f112d7e1dd8d64d17a4cc939 (patch) | |
| tree | cabf480269113686430053d66df3dadcd4d137a7 /plugins/check_cluster.c | |
| parent | a3cf9041af810770daf5d9b83f1906fa9bb0dd11 (diff) | |
| download | monitoring-plugins-802e46f8ea36c344f112d7e1dd8d64d17a4cc939.tar.gz | |
Run clang-format again
Diffstat (limited to 'plugins/check_cluster.c')
| -rw-r--r-- | plugins/check_cluster.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/plugins/check_cluster.c b/plugins/check_cluster.c index 9b695499..373520ee 100644 --- a/plugins/check_cluster.c +++ b/plugins/check_cluster.c | |||
| @@ -112,25 +112,30 @@ int main(int argc, char **argv) { | |||
| 112 | int return_code = STATE_OK; | 112 | int return_code = STATE_OK; |
| 113 | /* return the status of the cluster */ | 113 | /* return the status of the cluster */ |
| 114 | if (config.check_type == CHECK_SERVICES) { | 114 | if (config.check_type == CHECK_SERVICES) { |
| 115 | return_code = get_status(total_services_warning + total_services_unknown + total_services_critical, config.thresholds); | 115 | return_code = |
| 116 | printf("CLUSTER %s: %s: %d ok, %d warning, %d unknown, %d critical\n", state_text(return_code), | 116 | get_status(total_services_warning + total_services_unknown + total_services_critical, |
| 117 | (config.label == NULL) ? "Service cluster" : config.label, total_services_ok, total_services_warning, total_services_unknown, | 117 | config.thresholds); |
| 118 | printf("CLUSTER %s: %s: %d ok, %d warning, %d unknown, %d critical\n", | ||
| 119 | state_text(return_code), (config.label == NULL) ? "Service cluster" : config.label, | ||
| 120 | total_services_ok, total_services_warning, total_services_unknown, | ||
| 118 | total_services_critical); | 121 | total_services_critical); |
| 119 | } else { | 122 | } else { |
| 120 | return_code = get_status(total_hosts_down + total_hosts_unreachable, config.thresholds); | 123 | return_code = get_status(total_hosts_down + total_hosts_unreachable, config.thresholds); |
| 121 | printf("CLUSTER %s: %s: %d up, %d down, %d unreachable\n", state_text(return_code), | 124 | printf("CLUSTER %s: %s: %d up, %d down, %d unreachable\n", state_text(return_code), |
| 122 | (config.label == NULL) ? "Host cluster" : config.label, total_hosts_up, total_hosts_down, total_hosts_unreachable); | 125 | (config.label == NULL) ? "Host cluster" : config.label, total_hosts_up, |
| 126 | total_hosts_down, total_hosts_unreachable); | ||
| 123 | } | 127 | } |
| 124 | 128 | ||
| 125 | exit(return_code); | 129 | exit(return_code); |
| 126 | } | 130 | } |
| 127 | 131 | ||
| 128 | check_cluster_config_wrapper process_arguments(int argc, char **argv) { | 132 | check_cluster_config_wrapper process_arguments(int argc, char **argv) { |
| 129 | static struct option longopts[] = {{"data", required_argument, 0, 'd'}, {"warning", required_argument, 0, 'w'}, | 133 | static struct option longopts[] = { |
| 130 | {"critical", required_argument, 0, 'c'}, {"label", required_argument, 0, 'l'}, | 134 | {"data", required_argument, 0, 'd'}, {"warning", required_argument, 0, 'w'}, |
| 131 | {"host", no_argument, 0, 'h'}, {"service", no_argument, 0, 's'}, | 135 | {"critical", required_argument, 0, 'c'}, {"label", required_argument, 0, 'l'}, |
| 132 | {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, | 136 | {"host", no_argument, 0, 'h'}, {"service", no_argument, 0, 's'}, |
| 133 | {"help", no_argument, 0, 'H'}, {0, 0, 0, 0}}; | 137 | {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, |
| 138 | {"help", no_argument, 0, 'H'}, {0, 0, 0, 0}}; | ||
| 134 | 139 | ||
| 135 | check_cluster_config_wrapper result = { | 140 | check_cluster_config_wrapper result = { |
| 136 | .errorcode = OK, | 141 | .errorcode = OK, |
| @@ -251,7 +256,8 @@ void print_help(void) { | |||
| 251 | printf("\n"); | 256 | printf("\n"); |
| 252 | printf("%s\n", _("Examples:")); | 257 | printf("%s\n", _("Examples:")); |
| 253 | printf(" %s\n", "check_cluster -s -d 2,0,2,0 -c @3:"); | 258 | printf(" %s\n", "check_cluster -s -d 2,0,2,0 -c @3:"); |
| 254 | printf(" %s\n", _("Will alert critical if there are 3 or more service data points in a non-OK")); | 259 | printf(" %s\n", |
| 260 | _("Will alert critical if there are 3 or more service data points in a non-OK")); | ||
| 255 | printf(" %s\n", _("state.")); | 261 | printf(" %s\n", _("state.")); |
| 256 | 262 | ||
| 257 | printf(UT_SUPPORT); | 263 | printf(UT_SUPPORT); |
