diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-09-15 13:18:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-15 13:18:17 +0200 |
commit | 8ef825d85fb4d09c32ca44c545d6eb8d995ddea4 (patch) | |
tree | 5ab7b18797dfd5849dec7827c87ca3bb5fcb0993 /plugins/check_time.c | |
parent | a3cf9041af810770daf5d9b83f1906fa9bb0dd11 (diff) | |
parent | 204cf956f0b3db90d079321ee957b3860da7e33f (diff) | |
download | monitoring-plugins-8ef825d85fb4d09c32ca44c545d6eb8d995ddea4.tar.gz |
Merge pull request #2149 from RincewindsHat/clang-format
Clang format
Diffstat (limited to 'plugins/check_time.c')
-rw-r--r-- | plugins/check_time.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/plugins/check_time.c b/plugins/check_time.c index debf59f3..fc9ba3f9 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c | |||
@@ -87,7 +87,8 @@ int main(int argc, char **argv) { | |||
87 | } else { | 87 | } else { |
88 | result = STATE_UNKNOWN; | 88 | result = STATE_UNKNOWN; |
89 | } | 89 | } |
90 | die(result, _("TIME UNKNOWN - could not connect to server %s, port %d\n"), config.server_address, config.server_port); | 90 | die(result, _("TIME UNKNOWN - could not connect to server %s, port %d\n"), |
91 | config.server_address, config.server_port); | ||
91 | } | 92 | } |
92 | 93 | ||
93 | if (config.use_udp) { | 94 | if (config.use_udp) { |
@@ -99,7 +100,8 @@ int main(int argc, char **argv) { | |||
99 | } else { | 100 | } else { |
100 | result = STATE_UNKNOWN; | 101 | result = STATE_UNKNOWN; |
101 | } | 102 | } |
102 | die(result, _("TIME UNKNOWN - could not send UDP request to server %s, port %d\n"), config.server_address, config.server_port); | 103 | die(result, _("TIME UNKNOWN - could not send UDP request to server %s, port %d\n"), |
104 | config.server_address, config.server_port); | ||
103 | } | 105 | } |
104 | } | 106 | } |
105 | 107 | ||
@@ -123,7 +125,8 @@ int main(int argc, char **argv) { | |||
123 | } else { | 125 | } else { |
124 | result = STATE_UNKNOWN; | 126 | result = STATE_UNKNOWN; |
125 | } | 127 | } |
126 | die(result, _("TIME UNKNOWN - no data received from server %s, port %d\n"), config.server_address, config.server_port); | 128 | die(result, _("TIME UNKNOWN - no data received from server %s, port %d\n"), |
129 | config.server_address, config.server_port); | ||
127 | } | 130 | } |
128 | 131 | ||
129 | result = STATE_OK; | 132 | result = STATE_OK; |
@@ -137,7 +140,8 @@ int main(int argc, char **argv) { | |||
137 | 140 | ||
138 | if (result != STATE_OK) { | 141 | if (result != STATE_OK) { |
139 | die(result, _("TIME %s - %d second response time|%s\n"), state_text(result), (int)conntime, | 142 | die(result, _("TIME %s - %d second response time|%s\n"), state_text(result), (int)conntime, |
140 | perfdata("time", (long)conntime, "s", config.check_warning_time, (long)config.warning_time, config.check_critical_time, | 143 | perfdata("time", (long)conntime, "s", config.check_warning_time, |
144 | (long)config.warning_time, config.check_critical_time, | ||
141 | (long)config.critical_time, true, 0, false, 0)); | 145 | (long)config.critical_time, true, 0, false, 0)); |
142 | } | 146 | } |
143 | 147 | ||
@@ -157,10 +161,11 @@ int main(int argc, char **argv) { | |||
157 | } | 161 | } |
158 | 162 | ||
159 | printf(_("TIME %s - %lu second time difference|%s %s\n"), state_text(result), diff_time, | 163 | printf(_("TIME %s - %lu second time difference|%s %s\n"), state_text(result), diff_time, |
160 | perfdata("time", (long)conntime, "s", config.check_warning_time, (long)config.warning_time, config.check_critical_time, | 164 | perfdata("time", (long)conntime, "s", config.check_warning_time, |
165 | (long)config.warning_time, config.check_critical_time, | ||
161 | (long)config.critical_time, true, 0, false, 0), | 166 | (long)config.critical_time, true, 0, false, 0), |
162 | perfdata("offset", diff_time, "s", config.check_warning_diff, config.warning_diff, config.check_critical_diff, | 167 | perfdata("offset", diff_time, "s", config.check_warning_diff, config.warning_diff, |
163 | config.critical_diff, true, 0, false, 0)); | 168 | config.check_critical_diff, config.critical_diff, true, 0, false, 0)); |
164 | return result; | 169 | return result; |
165 | } | 170 | } |
166 | 171 | ||
@@ -230,7 +235,8 @@ check_time_config_wrapper process_arguments(int argc, char **argv) { | |||
230 | result.config.warning_diff = strtoul(optarg, NULL, 10); | 235 | result.config.warning_diff = strtoul(optarg, NULL, 10); |
231 | result.config.check_warning_diff = true; | 236 | result.config.check_warning_diff = true; |
232 | } else if (strspn(optarg, "0123456789:,") > 0) { | 237 | } else if (strspn(optarg, "0123456789:,") > 0) { |
233 | if (sscanf(optarg, "%lu%*[:,]%d", &result.config.warning_diff, &result.config.warning_time) == 2) { | 238 | if (sscanf(optarg, "%lu%*[:,]%d", &result.config.warning_diff, |
239 | &result.config.warning_time) == 2) { | ||
234 | result.config.check_warning_diff = true; | 240 | result.config.check_warning_diff = true; |
235 | result.config.check_warning_time = true; | 241 | result.config.check_warning_time = true; |
236 | } else { | 242 | } else { |
@@ -245,7 +251,8 @@ check_time_config_wrapper process_arguments(int argc, char **argv) { | |||
245 | result.config.critical_diff = strtoul(optarg, NULL, 10); | 251 | result.config.critical_diff = strtoul(optarg, NULL, 10); |
246 | result.config.check_critical_diff = true; | 252 | result.config.check_critical_diff = true; |
247 | } else if (strspn(optarg, "0123456789:,") > 0) { | 253 | } else if (strspn(optarg, "0123456789:,") > 0) { |
248 | if (sscanf(optarg, "%lu%*[:,]%d", &result.config.critical_diff, &result.config.critical_time) == 2) { | 254 | if (sscanf(optarg, "%lu%*[:,]%d", &result.config.critical_diff, |
255 | &result.config.critical_time) == 2) { | ||
249 | result.config.check_critical_diff = true; | 256 | result.config.check_critical_diff = true; |
250 | result.config.check_critical_time = true; | 257 | result.config.check_critical_time = true; |
251 | } else { | 258 | } else { |