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_real.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_real.c')
-rw-r--r-- | plugins/check_real.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/plugins/check_real.c b/plugins/check_real.c index ec0928ed..66d07f8f 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c | |||
@@ -78,7 +78,8 @@ int main(int argc, char **argv) { | |||
78 | /* try to connect to the host at the given port number */ | 78 | /* try to connect to the host at the given port number */ |
79 | int socket; | 79 | int socket; |
80 | if (my_tcp_connect(config.server_address, config.server_port, &socket) != STATE_OK) { | 80 | if (my_tcp_connect(config.server_address, config.server_port, &socket) != STATE_OK) { |
81 | die(STATE_CRITICAL, _("Unable to connect to %s on port %d\n"), config.server_address, config.server_port); | 81 | die(STATE_CRITICAL, _("Unable to connect to %s on port %d\n"), config.server_address, |
82 | config.server_port); | ||
82 | } | 83 | } |
83 | 84 | ||
84 | /* Part I - Server Check */ | 85 | /* Part I - Server Check */ |
@@ -166,7 +167,8 @@ int main(int argc, char **argv) { | |||
166 | /* Part I - Server Check */ | 167 | /* Part I - Server Check */ |
167 | 168 | ||
168 | /* send the DESCRIBE request */ | 169 | /* send the DESCRIBE request */ |
169 | sprintf(buffer, "DESCRIBE rtsp://%s:%d%s RTSP/1.0\r\n", config.host_name, config.server_port, config.server_url); | 170 | sprintf(buffer, "DESCRIBE rtsp://%s:%d%s RTSP/1.0\r\n", config.host_name, |
171 | config.server_port, config.server_url); | ||
170 | 172 | ||
171 | ssize_t sent_bytes = send(socket, buffer, strlen(buffer), 0); | 173 | ssize_t sent_bytes = send(socket, buffer, strlen(buffer), 0); |
172 | if (sent_bytes == -1) { | 174 | if (sent_bytes == -1) { |
@@ -200,7 +202,8 @@ int main(int argc, char **argv) { | |||
200 | if (config.server_port == PORT) { | 202 | if (config.server_port == PORT) { |
201 | printf("%s\n", _("Invalid REAL response received from host")); | 203 | printf("%s\n", _("Invalid REAL response received from host")); |
202 | } else { | 204 | } else { |
203 | printf(_("Invalid REAL response received from host on port %d\n"), config.server_port); | 205 | printf(_("Invalid REAL response received from host on port %d\n"), |
206 | config.server_port); | ||
204 | } | 207 | } |
205 | } else { | 208 | } else { |
206 | 209 | ||
@@ -256,7 +259,8 @@ int main(int argc, char **argv) { | |||
256 | } | 259 | } |
257 | 260 | ||
258 | /* Put some HTML in here to create a dynamic link */ | 261 | /* Put some HTML in here to create a dynamic link */ |
259 | printf(_("REAL %s - %d second response time\n"), state_text(result), (int)(end_time - start_time)); | 262 | printf(_("REAL %s - %d second response time\n"), state_text(result), |
263 | (int)(end_time - start_time)); | ||
260 | } else { | 264 | } else { |
261 | printf("%s\n", status_line); | 265 | printf("%s\n", status_line); |
262 | } | 266 | } |
@@ -272,12 +276,13 @@ int main(int argc, char **argv) { | |||
272 | 276 | ||
273 | /* process command-line arguments */ | 277 | /* process command-line arguments */ |
274 | check_real_config_wrapper process_arguments(int argc, char **argv) { | 278 | check_real_config_wrapper process_arguments(int argc, char **argv) { |
275 | static struct option longopts[] = {{"hostname", required_argument, 0, 'H'}, {"IPaddress", required_argument, 0, 'I'}, | 279 | static struct option longopts[] = { |
276 | {"expect", required_argument, 0, 'e'}, {"url", required_argument, 0, 'u'}, | 280 | {"hostname", required_argument, 0, 'H'}, {"IPaddress", required_argument, 0, 'I'}, |
277 | {"port", required_argument, 0, 'p'}, {"critical", required_argument, 0, 'c'}, | 281 | {"expect", required_argument, 0, 'e'}, {"url", required_argument, 0, 'u'}, |
278 | {"warning", required_argument, 0, 'w'}, {"timeout", required_argument, 0, 't'}, | 282 | {"port", required_argument, 0, 'p'}, {"critical", required_argument, 0, 'c'}, |
279 | {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, | 283 | {"warning", required_argument, 0, 'w'}, {"timeout", required_argument, 0, 't'}, |
280 | {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; | 284 | {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, |
285 | {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; | ||
281 | 286 | ||
282 | check_real_config_wrapper result = { | 287 | check_real_config_wrapper result = { |
283 | .errorcode = OK, | 288 | .errorcode = OK, |
@@ -427,7 +432,8 @@ void print_help(void) { | |||
427 | printf("%s\n", _("This plugin will attempt to open an RTSP connection with the host.")); | 432 | printf("%s\n", _("This plugin will attempt to open an RTSP connection with the host.")); |
428 | printf("%s\n", _("Successful connects return STATE_OK, refusals and timeouts return")); | 433 | printf("%s\n", _("Successful connects return STATE_OK, refusals and timeouts return")); |
429 | printf("%s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful connects,")); | 434 | printf("%s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful connects,")); |
430 | printf("%s\n", _("but incorrect response messages from the host result in STATE_WARNING return")); | 435 | printf("%s\n", |
436 | _("but incorrect response messages from the host result in STATE_WARNING return")); | ||
431 | printf("%s\n", _("values.")); | 437 | printf("%s\n", _("values.")); |
432 | 438 | ||
433 | printf(UT_SUPPORT); | 439 | printf(UT_SUPPORT); |