diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-04 11:02:33 +0100 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-04 11:02:33 +0100 |
| commit | 554bf3e5256f5489aed0cd56f0c600bcb281a7f5 (patch) | |
| tree | 7bfd651246005043e91be597ad82ca79ff3207e0 /plugins/check_tcp.d/config.h | |
| parent | 06fa1036f9e7216aac27107cd7d4c4903fa61ab2 (diff) | |
| download | monitoring-plugins-554bf3e5256f5489aed0cd56f0c600bcb281a7f5.tar.gz | |
Refactor check_tcp and implement new output format
Diffstat (limited to 'plugins/check_tcp.d/config.h')
| -rw-r--r-- | plugins/check_tcp.d/config.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/plugins/check_tcp.d/config.h b/plugins/check_tcp.d/config.h new file mode 100644 index 00000000..7ecf51a6 --- /dev/null +++ b/plugins/check_tcp.d/config.h | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../common.h" | ||
| 4 | #include "../../lib/utils_tcp.h" | ||
| 5 | #include <netinet/in.h> | ||
| 6 | |||
| 7 | typedef struct check_tcp_config { | ||
| 8 | char *server_address; | ||
| 9 | bool host_specified; | ||
| 10 | int server_port; // TODO can this be a uint16? | ||
| 11 | |||
| 12 | int protocol; /* most common is default */ | ||
| 13 | char *service; | ||
| 14 | char *send; | ||
| 15 | char *quit; | ||
| 16 | char **server_expect; | ||
| 17 | size_t server_expect_count; | ||
| 18 | #ifdef HAVE_SSL | ||
| 19 | bool use_tls; | ||
| 20 | char *sni; | ||
| 21 | bool sni_specified; | ||
| 22 | bool check_cert; | ||
| 23 | int days_till_exp_warn; | ||
| 24 | int days_till_exp_crit; | ||
| 25 | #endif // HAVE_SSL | ||
| 26 | int match_flags; | ||
| 27 | int expect_mismatch_state; | ||
| 28 | unsigned int delay; | ||
| 29 | |||
| 30 | bool warning_time_set; | ||
| 31 | double warning_time; | ||
| 32 | bool critical_time_set; | ||
| 33 | double critical_time; | ||
| 34 | |||
| 35 | int econn_refuse_state; | ||
| 36 | |||
| 37 | ssize_t maxbytes; | ||
| 38 | |||
| 39 | bool hide_output; | ||
| 40 | } check_tcp_config; | ||
| 41 | |||
| 42 | check_tcp_config check_tcp_config_init() { | ||
| 43 | check_tcp_config result = { | ||
| 44 | .server_address = "127.0.0.1", | ||
| 45 | .host_specified = false, | ||
| 46 | .server_port = 0, | ||
| 47 | |||
| 48 | .protocol = IPPROTO_TCP, | ||
| 49 | .service = "TCP", | ||
| 50 | .send = NULL, | ||
| 51 | .quit = NULL, | ||
| 52 | .server_expect = NULL, | ||
| 53 | .server_expect_count = 0, | ||
| 54 | #ifdef HAVE_SSL | ||
| 55 | .use_tls = false, | ||
| 56 | .sni = NULL, | ||
| 57 | .sni_specified = false, | ||
| 58 | .check_cert = false, | ||
| 59 | .days_till_exp_warn = 0, | ||
| 60 | .days_till_exp_crit = 0, | ||
| 61 | #endif // HAVE_SSL | ||
| 62 | .match_flags = NP_MATCH_EXACT, | ||
| 63 | .expect_mismatch_state = STATE_WARNING, | ||
| 64 | .delay = 0, | ||
| 65 | |||
| 66 | .warning_time_set = false, | ||
| 67 | .warning_time = 0, | ||
| 68 | .critical_time_set = false, | ||
| 69 | .critical_time = 0, | ||
| 70 | |||
| 71 | .econn_refuse_state = STATE_CRITICAL, | ||
| 72 | |||
| 73 | .maxbytes = 0, | ||
| 74 | |||
| 75 | .hide_output = false, | ||
| 76 | }; | ||
| 77 | return result; | ||
| 78 | } | ||
