Using SSH to run remote command checks

Mark.Law at thomson.com Mark.Law at thomson.com
Thu Dec 22 18:55:52 CET 2005


Thanks for the reply .

Yeah, I'm running the command '/usr/bin/ssh -l nagios blah blah', works
from command line, no output.  I have specifically logged into our
nagios site as the nagios user and run the test just fine.

I went so far as to create a small script on the target system that
writes out a timestamp when it is called - again, works from the command
line, not from nagios, in fact, from nagios, the log file never gets
written.  Did a tcpdump - no avail.

Is there some more verbose logging that can be turned on that will
capture *everything* happening during nagios tests?

Thanks,
Mark  

-----Original Message-----
From: nagios-users-admin at lists.sourceforge.net
[mailto:nagios-users-admin at lists.sourceforge.net] On Behalf Of Marc
Powell
Sent: Thursday, December 22, 2005 12:07 PM
To: nagios-users at lists.sourceforge.net
Subject: RE: [Nagios-users] Using SSH to run remote command checks



> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
> admin at lists.sourceforge.net] On Behalf Of Mark.Law at thomson.com
> Sent: Thursday, December 22, 2005 8:46 AM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Using SSH to run remote command checks
> 
> I tested the following command from the command line ~
> 
> /usr/bin/ssh -l nagios host1 chkAdminServer.pl
> 
> and it returns OK with an exit code of 0.  Great.
> 
> When I put it into the following service definition, I get a Status
> UNKNOWN with STATUS INFORMATION (No Output)
> 
> define service{
>   name                            check_adminserver
>   service_description             AdminServer
>   use                             hg.prod.check_5min
>   host                            host1,host2
>   contact_groups                  systemgrp
>   check_command
> check_command_ssh!/path/to/perl/script/bin/chkAdminServer.pl!
> }
> 
> The check command definition is really simple also ~
> 
> define command{
>   command_name    check_command_ssh
>   command_line    /usr/bin/ssh -l nagios $HOSTADDRESS$ $ARG1$
> }
>
> I have checked permissions, log files, verified public keys on the
> remote server, everything I can think of - but it continues to fail.
In
> fact, it appears that the command isn't even attempting to run.   Any
> ideas?

The majority of the time this happens because people run their tests as
root or some other user who does not have the same access levels as the
nagios user. Did you perform your test as the nagios user? My first
suspicion is that the host key hasn't been accepted for that host for
the nagios user.

You can also try changing your command definition to make sure nagios is
calling ssh and in exactly the way you expect it is with --


define command{
  command_name    check_command_ssh
  command_line    echo "/usr/bin/ssh -l nagios $HOSTADDRESS$ $ARG1$"
>>/tmp/ssh_exec
}

--
Marc


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=ick
_______________________________________________
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




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
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