check_by_ssh

Andreas Ericsson ae at op5.se
Thu Nov 9 20:18:56 CET 2006


Robert Fitzpatrick wrote:
> On Thu, 2006-11-09 at 10:51 -0600, Marc Powell wrote:
>> You must be running something different from the command line as the
>> above could never work. Check_by_ssh is expecting -C to be a full path
>> and command to run on a remote host. I'm doing the same kind of thing
>> with --
> Yes, I was running the check_nagios on the remote server.
> 
>>
>> define command {
>>     command_name                   check_nagios
>>     command_line                   $USER1$/check_by_ssh -H $HOSTADDRESS$
>> -C "/usr/local/nagios/libexec/check_nagios
>> /usr/local/nagios/var/status.dat 5 'bin/nagios'"
>>     }
>>
>> You're telling it to run the command "-e 60 -F ..." on the remote host
>> which isn't valid and since it starts with '-e' that check_by_ssh is
>> going to interpret that as an option to itself.
>>
> Thanks! Got it working and now trying to add another server to the
> hostgroup. Unbelievably, it works from the command line, but reports
> 'Host key verification failed' in the log and sends notifications. I run
> this from the command line and it works with no password required...
> 
> genoa# /usr/local/libexec/nagios/check_by_ssh -H <host IP> -l <snip> -i <snip> -C "/usr/local/libexec/nagios/check_nagios /var/spool/nagios/status.dat 5 '/usr/local/bin/nagios'"
> NAGIOS OK: 1 process, status log updated 5 seconds ago
> genoa# tail -1 /var/spool/nagios/nagios.log
> [1163098643] SERVICE ALERT: esmtp-ky;NAGIOS;WARNING;HARD;3;Host key verification failed.
> 

If this is a cut 'n paste, you're running the commands from command-line 
as root, while Nagios is running as a pseudo-user and thus uses a 
different ~/.ssh/id_[rd]sa.pub

Always, always, always run things from command-line as the same user 
nagios runs as. Can't be iterated enough, really.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list