summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Nierlein <sven@nierlein.de>2016-03-10 20:33:49 (GMT)
committerSven Nierlein <sven@nierlein.de>2016-09-17 05:45:08 (GMT)
commit3a12034805caf6c4ad21a8f86c8e4a43ff62576c (patch)
tree57f6b8d2d35f0220be6a0f3321ec7ba4e46254c5
parent8672529b37fc73fbcc15cb2b2ba9b677f37dac5e (diff)
downloadmonitoring-plugins-3a12034805caf6c4ad21a8f86c8e4a43ff62576c.tar.gz
check_by_ssh: print command output in verbose mode
right now it is not possible to print the command output of ssh. check_by_ssh only prints the command itself. This patchs adds printing the output too. This makes it possible to use ssh with verbose logging which helps debuging any connection, key or other ssh problems. Note: you must use -E,--skip-stderr=<high number>, otherwise check_by_ssh would always exit with unknown state. Example: ./check_by_ssh -H localhost -o LogLevel=DEBUG3 -C "sleep 1" -E 999 -v Signed-off-by: Sven Nierlein <sven@nierlein.de>
-rw-r--r--plugins/check_by_ssh.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index 04bce38..13d8bc3 100644
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.c
@@ -100,6 +100,13 @@ main (int argc, char **argv)
100 100
101 result = cmd_run_array (commargv, &chld_out, &chld_err, 0); 101 result = cmd_run_array (commargv, &chld_out, &chld_err, 0);
102 102
103 if (verbose) {
104 for(i = 0; i < chld_out.lines; i++)
105 printf("stdout: %s\n", chld_out.line[i]);
106 for(i = 0; i < chld_err.lines; i++)
107 printf("stderr: %s\n", chld_err.line[i]);
108 }
109
103 if (skip_stdout == -1) /* --skip-stdout specified without argument */ 110 if (skip_stdout == -1) /* --skip-stdout specified without argument */
104 skip_stdout = chld_out.lines; 111 skip_stdout = chld_out.lines;
105 if (skip_stderr == -1) /* --skip-stderr specified without argument */ 112 if (skip_stderr == -1) /* --skip-stderr specified without argument */