diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-13 12:25:29 +0100 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-13 12:25:29 +0100 |
| commit | c8014631de0f7927d8c75ff87225b5a24e9b9942 (patch) | |
| tree | 0f48aeaebad7b5e19ae809ee2821c21f2eacb51b | |
| parent | a693cc0aa3d79f85115be48bcd81c0ec371e78a0 (diff) | |
| download | monitoring-plugins-c8014631de0f7927d8c75ff87225b5a24e9b9942.tar.gz | |
check_tcp: add output if answer matches expectations
| -rw-r--r-- | plugins/check_tcp.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 8cd86460..d1f6b84f 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
| @@ -261,7 +261,7 @@ int main(int argc, char **argv) { | |||
| 261 | #ifdef HAVE_SSL | 261 | #ifdef HAVE_SSL |
| 262 | if (config.use_tls) { | 262 | if (config.use_tls) { |
| 263 | mp_subcheck tls_connection_result = mp_subcheck_init(); | 263 | mp_subcheck tls_connection_result = mp_subcheck_init(); |
| 264 | int result = np_net_ssl_init_with_hostname(socket_descriptor, (config.sni_specified ? config.sni : NULL)); | 264 | mp_state_enum result = np_net_ssl_init_with_hostname(socket_descriptor, (config.sni_specified ? config.sni : NULL)); |
| 265 | tls_connection_result = mp_set_subcheck_state(tls_connection_result, result); | 265 | tls_connection_result = mp_set_subcheck_state(tls_connection_result, result); |
| 266 | 266 | ||
| 267 | if (result == STATE_OK) { | 267 | if (result == STATE_OK) { |
| @@ -448,6 +448,10 @@ int main(int argc, char **argv) { | |||
| 448 | expected_data_result = mp_set_subcheck_state(expected_data_result, config.expect_mismatch_state); | 448 | expected_data_result = mp_set_subcheck_state(expected_data_result, config.expect_mismatch_state); |
| 449 | xasprintf(&expected_data_result.output, "Answer failed to match expectation"); | 449 | xasprintf(&expected_data_result.output, "Answer failed to match expectation"); |
| 450 | mp_add_subcheck_to_check(&overall, expected_data_result); | 450 | mp_add_subcheck_to_check(&overall, expected_data_result); |
| 451 | } else if (match == NP_MATCH_SUCCESS) { | ||
| 452 | expected_data_result = mp_set_subcheck_state(expected_data_result, STATE_OK); | ||
| 453 | xasprintf(&expected_data_result.output, "The answer of the server matched the expectation"); | ||
| 454 | mp_add_subcheck_to_check(&overall, expected_data_result); | ||
| 451 | } | 455 | } |
| 452 | 456 | ||
| 453 | /* reset the alarm */ | 457 | /* reset the alarm */ |
