summaryrefslogtreecommitdiffstats
path: root/plugins/check_by_ssh.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_by_ssh.c')
-rw-r--r--plugins/check_by_ssh.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index ad385fbd..8036ffa4 100644
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.c
@@ -103,7 +103,24 @@ int main(int argc, char **argv) {
103 sc_ssh_execution = mp_set_subcheck_state(sc_ssh_execution, STATE_UNKNOWN); 103 sc_ssh_execution = mp_set_subcheck_state(sc_ssh_execution, STATE_UNKNOWN);
104 mp_add_subcheck_to_check(&overall, sc_ssh_execution); 104 mp_add_subcheck_to_check(&overall, sc_ssh_execution);
105 mp_exit(overall); 105 mp_exit(overall);
106 } else if (child_result.cmd_error_code != 0) {
107 xasprintf(&sc_ssh_execution.output, "SSH connection failed: ");
108
109 if (child_result.stderr.lines > 0) {
110 for (size_t i = 0; i < child_result.stderr.lines; i++) {
111 xasprintf(&sc_ssh_execution.output, "%s\n%s", sc_ssh_execution.output,
112 child_result.stderr.line[i]);
113 }
114 } else {
115 xasprintf(&sc_ssh_execution.output, "%s %s", sc_ssh_execution.output,
116 "no output on stderr");
117 }
118
119 sc_ssh_execution = mp_set_subcheck_state(sc_ssh_execution, STATE_UNKNOWN);
120 mp_add_subcheck_to_check(&overall, sc_ssh_execution);
121 mp_exit(overall);
106 } 122 }
123
107 xasprintf(&sc_ssh_execution.output, "SSH connection succeeded"); 124 xasprintf(&sc_ssh_execution.output, "SSH connection succeeded");
108 sc_ssh_execution = mp_set_subcheck_state(sc_ssh_execution, STATE_OK); 125 sc_ssh_execution = mp_set_subcheck_state(sc_ssh_execution, STATE_OK);
109 mp_add_subcheck_to_check(&overall, sc_ssh_execution); 126 mp_add_subcheck_to_check(&overall, sc_ssh_execution);