Page 1 of 3

check_by_ssh time out issue

Posted: Thu Jul 02, 2015 7:55 am
by bosecorp
I am trying to monitor few servers using SSH, but I am getting the error below. if I run the check from the CLI works fine. I am running the check as root and also as Nagios.


Critical

Command: /usr/bin/ssh

Argument 1: myIPADDRESS
Argument 2: /usr/local/nagios/libexec/check_disk /
CRITICAL - Plugin timed out after 10 seconds

Re: check_by_ssh time out issue

Posted: Thu Jul 02, 2015 8:48 am
by tgriep
Could you post how you have the check setup in Nagios XI and how you ran it from the command line?

For your second arguments, do you have them in double quotes? That may be needed because of the space in the command.

Re: check_by_ssh time out issue

Posted: Thu Jul 02, 2015 8:56 am
by bosecorp
I do have them with double quotes

# ./check_by_ssh -H myserver -C "/usr/local/nagios/libexec/check_disk /"
DISK OK - free space: / 324 MB (56% inode=90%);| /=251MB;;;0;576

Re: check_by_ssh time out issue

Posted: Thu Jul 02, 2015 9:20 am
by tgriep
I tested your example and it worked for me. Lets check and see if you can ssh in to the remote system without being prompted for a password. Try running this on the XI system in a shell.

Code: Select all

su nagios
ssh <IP Address of the remote system>
Post back the output.
Is should not prompt for a password.

Re: check_by_ssh time out issue

Posted: Thu Jul 02, 2015 9:22 am
by bosecorp
[nagios@nagmonus1 ~]$ ssh myserver
Last unsuccessful login: Thu Jul 2 07:04:10 EDT 2015 on ssh from nagmonus1.bose.com
Last login: Thu Jul 2 08:27:40 EDT 2015 on /dev/pts/1 from nagmonus1.bose.com
*******************************************************************************
* *
* *
* Welcome to AIX Version 7.1! *
* *
* *
* Please see the README file in /usr/lpp/bos for information pertinent to *
* this release of the AIX Operating System. *
* *
* *
*******************************************************************************
[YOU HAVE NEW MAIL]
$

Re: check_by_ssh time out issue

Posted: Thu Jul 02, 2015 9:23 am
by lmiltchev
Can you also try timing the check, even though it is highly unlikely it actually timed out...

Code: Select all

su nagios
time /usr/local/nagios/libexec/check_by_ssh -H x.x.x.x -C "/usr/local/nagios/libexec/check_disk /" -v
Command: /usr/bin/ssh
Argument 1: x.x.x.x
Argument 2: /usr/local/nagios/libexec/check_disk /
DISK OK - free space: / 4850 MB (29% inode=70%);| /=11801MB;;;0;17544

real    0m0.129s
user    0m0.008s
sys     0m0.002s

Re: check_by_ssh time out issue

Posted: Thu Jul 02, 2015 9:26 am
by bosecorp
from CLI, here is the result

[nagios@nagmonus1 ~]$ time /usr/local/nagios/libexec/check_by_ssh -H myserver -C "/usr/local/nagios/libexec/check_disk /" -v
Command: /usr/bin/ssh
Argument 1: myserver
Argument 2: /usr/local/nagios/libexec/check_disk /
DISK OK - free space: / 324 MB (56% inode=90%);| /=251MB;;;0;576

real 0m0.620s
user 0m0.015s
sys 0m0.011s
You have mail in /var/spool/mail/nagios

Re: check_by_ssh time out issue

Posted: Thu Jul 02, 2015 9:37 am
by lmiltchev
Can you find any clues in the remote server's logs? I am not sure where the AIX version of "secure" log would be... "/var/log/authlog"? Also, check the nagios.log on the Nagios XI server.

Code: Select all

tail -100 /usr/local/nagios/var/nagios.log

Re: check_by_ssh time out issue

Posted: Thu Jul 02, 2015 10:29 am
by bosecorp
[1435836260] SERVICE ALERT: ac1db1.bose.com;Check root;UNKNOWN;SOFT;1;Remote command execution failed: ssh: connect to host 10.0.x.x port 22: Connection timed out

Re: check_by_ssh time out issue

Posted: Thu Jul 02, 2015 10:36 am
by lmiltchev
Anything in the remote logs?