summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_ssh.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index 3d6a0710..d06af3e7 100644
--- a/plugins/check_ssh.c
+++ b/plugins/check_ssh.c
@@ -235,7 +235,11 @@ int ssh_connect(mp_check *overall, char *haddr, int hport, char *desired_remote_
235 int socket; 235 int socket;
236 int result = my_tcp_connect(haddr, hport, &socket); 236 int result = my_tcp_connect(haddr, hport, &socket);
237 237
238 mp_subcheck connection_sc = mp_subcheck_init();
238 if (result != STATE_OK) { 239 if (result != STATE_OK) {
240 connection_sc = mp_set_subcheck_state(connection_sc, STATE_CRITICAL);
241 xasprintf(&connection_sc.output, "Failed to establish TCP connection to Host %s and Port %d", haddr, hport);
242 mp_add_subcheck_to_check(overall, connection_sc);
239 return result; 243 return result;
240 } 244 }
241 245
@@ -280,7 +284,6 @@ int ssh_connect(mp_check *overall, char *haddr, int hport, char *desired_remote_
280 } 284 }
281 } 285 }
282 286
283 mp_subcheck connection_sc = mp_subcheck_init();
284 if (recv_ret < 0) { 287 if (recv_ret < 0) {
285 connection_sc = mp_set_subcheck_state(connection_sc, STATE_CRITICAL); 288 connection_sc = mp_set_subcheck_state(connection_sc, STATE_CRITICAL);
286 xasprintf(&connection_sc.output, "%s", "SSH CRITICAL - %s", strerror(errno)); 289 xasprintf(&connection_sc.output, "%s", "SSH CRITICAL - %s", strerror(errno));