Commmand works on the host I need to monitor (its IP is denoted as $HOSTADDRESS$ here):
[root@host ~]# /usr/local/nagios/libexec/check_ssh localhost
SSH OK - OpenSSH_4.3 (protocol 2.0)
However, on the Nagios server, it does not:
root@server:~# /usr/lib/nagios/plugins/check_ssh -H $HOSTADDRESS$
Server answer:
I can see that the port is open:
root@server:~# /usr/lib/nagios/plugins/check_tcp -H $HOSTADDRESS$ -p 22
TCP OK - 0.123 second response time on port 22|time=0.123277s;;;0.000000;10.000000
And I can verify with telnet:
root@server:/etc/nagios3/conf.d# telnet $HOSTADDRESS$ 22
Trying $HOSTADDRESS$...
Connected to $HOSTADDRESS$.
Escape character is '^]'.
After searching the web for two hours and trying different suggestions I am out of ideas. I have several other hosts with similar setup, and they don't have this problem. I have compared the configs and they look the same (I think).
I am clearly missing something here.
Best Answer
I had the same problem to check an OpenSSH server installed on Windows (KpyM Telnet/SSH Server) and I'm checking the port using check_ssh from my Nagios linux server.
With "
check_ssh
", I got the answer "Server answer" With "check_tcp
" on the port 22 :SSH OK
In the logs of the SSH server on Windows, the ip of the nagios server was in the banned IPs.
I removed the IP in the banned IPs and check_ssh is now ok :
check_ssh
answer is now :SSH OK - cryptlib (protocol 2.0)
Maybe it helps. Probably not the same software but maybe the same behaviour.