The check_by_ssh plugin is having problems due to the /etc/issue banner. On the command line here is what is happening:
user@mysystem $ ./check_by_ssh -H mysystem -C "/bin/ls /tmp"
Remote command execution failed: Warning:
In the Nagios viewer it shows a key failure (which is not the case here)
However, I can ssh to the system on the command line:
user@mysystem $ ssh -q mysystem
Last login: Mon May 11 00:01:00 2009 from 192.168.0.12
(newuser)othersystem:/home/newuser#
If I run this command which suppresses the banner and creates a fake tty:
[user@mysystem dir]$ ssh -q -t othersystem -C "/bin/ls /tmp"
The above command works.
The problem is that the check_by_ssh command does not let me put the -t or -q flags in it to make this command possible. In fact the -t command is short for "timeout" in check_by_ssh.
Is there some kind of workaround I can use with the check_by_ssh command? I'd prefer to use check_by_ssh with its options so it saves me the headache of creating my own plugin.
Problem with check_by_ssh
Re: Problem with check_by_ssh
I don't understand why you are using '-t' this should not do anything. It would request a PTY if and only if it was being run from any kind of TTY. As it's only being run from a TTY when you are on the command line and not when run from Nagios it should not have any effect.
That said, what is the goal of allocating a PTY? If I wrote ssh I could imagine that I'd not display the banner if there was not a TTY, '-T'. However to disable the banner all you should need is a quiet '-q'... or two.
However check_by_ssh supports this feature:
-q, --quiet
Tell ssh to suppress warning and diagnostic messages [optional]
That said, what is the goal of allocating a PTY? If I wrote ssh I could imagine that I'd not display the banner if there was not a TTY, '-T'. However to disable the banner all you should need is a quiet '-q'... or two.
However check_by_ssh supports this feature:
-q, --quiet
Tell ssh to suppress warning and diagnostic messages [optional]
Re: Problem with check_by_ssh
I created a temporary patch that allows me to use the -z option which adds a "-t" to the ssh command allowing everything to work.
Last edited by niebais on Mon May 17, 2010 10:43 am, edited 1 time in total.
Re: Problem with check_by_ssh
If I use just the -q option, it doesn't work on these systems.
Re: Problem with check_by_ssh
-T Disable pseudo-tty allocation.
-t Force pseudo-tty allocation. This can be used to execute arbi-
trary screen-based programs on a remote machine, which can be
very useful, e.g., when implementing menu services. Multiple -t
options force tty allocation, even if ssh has no local tty.
Capitol -T works as well. I think that's a better option to use anyway.
-t Force pseudo-tty allocation. This can be used to execute arbi-
trary screen-based programs on a remote machine, which can be
very useful, e.g., when implementing menu services. Multiple -t
options force tty allocation, even if ssh has no local tty.
Capitol -T works as well. I think that's a better option to use anyway.
Re: Problem with check_by_ssh
Correct. Though keep in mind that unless you are testing with out a TTY then you are not properly emulating the environment that Nagios would use. To disable your TTY you could use something like "ssh -T 127.0.0.1". Not having a TTY is difficult, process interruption "ctrl-C" and "ctrl-Z" don't work and many of the tty-echo features that allow for backspacing don't work.
Re: Problem with check_by_ssh
I've got this working with the patch. This thread can be marked as done.