check_by_ssh not working but ssh is ok

Here’s the scenario:

user John can connect via ssh to SONICSERVER using oracle user without authentication. To verify, i run this command and encountered no problem:

ssh -i /home/John/.ssh/id_rsa oracle@SONICSERVER w

and the commands run properly.

But when i tried this command:

[John@SONICSERVER ~]$ /usr/local/nagios/libexec/check_by_ssh -H SONICSERVER -i /home/John/.ssh/id_rsa
-C “/usr/local/nagios/libexec/check_disk -w 10% -c 5% -e -m” -l oracle

It says:

CRITICAL - Plugin timed out while executing system call

Is there something wrong in the command??? Plugins was own by nagios but i set permission that others can execute it as well.

most likely it’s due to not being able to access the id file.
In your first command it was
/etc/nagios/.ssh/id_rsa
but your 2nd it’s
/home/John/.ssh/id_rsa

So, let’s compare apples to apples this time, and see if it works.

@jakkedup

sorry for the typo error. Its the same as John.

Still problem exists

i just notice that most people that uses nagios monitoring via ssh uses dsa not rsa which i uses above. Is there a diffrence between dsa and rsa when using it to nagios??

BTW, I also tried :

/usr/local/nagios/libexec/check_by_ssh -H SONICSERVER -i /home/oracle/.ssh/authorized_keys -C ‘/usr/local/nagios/libexec/check_swap -w 50% -c 10%’ -l oracle

but encounter the same error:

CRITICAL - Plugin timed out while executing system call

I don’t know how to fix your problem with the check, but I would suggest you setup a passive solution to make those checks on a remote system. Instead of your active check, like you are attempting.
You could setup your ssh connection to automatically login by passing the keys for that user. That way, you won’t have to define all the stuff you are attempting to use, in your ssh check.