[monitoring-plugins] check_tcp: add output if answer matches ...
Lorenz Kästle
git at monitoring-plugins.org
Thu Mar 13 15:20:13 CET 2025
Module: monitoring-plugins
Branch: master
Commit: c8014631de0f7927d8c75ff87225b5a24e9b9942
Author: Lorenz Kästle <12514511+RincewindsHat at users.noreply.github.com>
Date: Thu Mar 13 12:25:29 2025 +0100
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=c8014631
check_tcp: add output if answer matches expectations
---
plugins/check_tcp.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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) {
#ifdef HAVE_SSL
if (config.use_tls) {
mp_subcheck tls_connection_result = mp_subcheck_init();
- int result = np_net_ssl_init_with_hostname(socket_descriptor, (config.sni_specified ? config.sni : NULL));
+ mp_state_enum result = np_net_ssl_init_with_hostname(socket_descriptor, (config.sni_specified ? config.sni : NULL));
tls_connection_result = mp_set_subcheck_state(tls_connection_result, result);
if (result == STATE_OK) {
@@ -448,6 +448,10 @@ int main(int argc, char **argv) {
expected_data_result = mp_set_subcheck_state(expected_data_result, config.expect_mismatch_state);
xasprintf(&expected_data_result.output, "Answer failed to match expectation");
mp_add_subcheck_to_check(&overall, expected_data_result);
+ } else if (match == NP_MATCH_SUCCESS) {
+ expected_data_result = mp_set_subcheck_state(expected_data_result, STATE_OK);
+ xasprintf(&expected_data_result.output, "The answer of the server matched the expectation");
+ mp_add_subcheck_to_check(&overall, expected_data_result);
}
/* reset the alarm */
More information about the Commits
mailing list