Re: [Nagios-users] Using SSH to run remote command checks

2007-02-16 Thread Nagios Mail

I wanted to update this problem as it appears to have never been resolved.
The current version of check_by_ssh still returns an UKNOWN status in
nagios. I have ran the command manually from the command line and echoed $?,
and while it does return 0, nagios is putting in an UNKNOWN status. Not only
that but the status appears to be flapping.

The Critical and Warning status appear to work every time, but when an OK
status is returned from one of the check programs (check_load, check_disk,
check_process), check_by_ssh returns an UNKNOWN almost 80% of the time.

I've followed up with three different people on this list who have reported
the problem, and all of them just decided to move to NRPE.

Has anyone gotten this plugin to work? I am assuming this is a code problem
with check_by_ssh



On 12/22/05, Demetri Mouratis [EMAIL PROTECTED] wrote:


On Thu, 22 Dec 2005, [EMAIL PROTECTED] wrote:

 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{
  namecheck_adminserver
  service_description AdminServer
  use hg.prod.check_5min
  hosthost1,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_namecheck_command_ssh
  command_line/usr/bin/ssh -l nagios $HOSTADDRESS$ $ARG1$
 }
If you are trying to ssh to another server and kick off the command there
use check_by_ssh as follows:

# check-remote-load
define command{
 command_namecheck-remote-load
 command_line$USER1$/check_by_ssh -H $HOSTADDRESS$ -C
$USER1$/check_load -w $ARG1$ -c $ARG2$
 }

In your example, put the chkAdminServer.pl scripts in the nagios plugins
directory on the target, e.g. /usr/lib/nagios/plugins then set the $USER1$
variable to the same.  Then, su - nagios of your nagios box and ssh target
/usr/lib/nagios/plugins/chkAdminServer.pl.


---
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_id=7637alloc_id=16865op=click
___
Nagios-users mailing list
Nagios-users@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

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Nagios-users mailing list
Nagios-users@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

Re: [Nagios-users] Using SSH to run remote command checks

2007-02-16 Thread Andy Shellam (Mailing Lists)
Nagios Mail wrote:
 I wanted to update this problem as it appears to have never been 
 resolved. The current version of check_by_ssh still returns an 
 UKNOWN status in nagios. I have ran the command manually from the 
 command line and echoed $?, and while it does return 0, nagios is 
 putting in an UNKNOWN status. Not only that but the status appears to 
 be flapping.

 The Critical and Warning status appear to work every time, but when an 
 OK status is returned from one of the check programs (check_load, 
 check_disk, check_process), check_by_ssh returns an UNKNOWN almost 80% 
 of the time.

 I've followed up with three different people on this list who have 
 reported the problem, and all of them just decided to move to NRPE.

 Has anyone gotten this plugin to work? I am assuming this is a code 
 problem with check_by_ssh

I just get the following very helpful error message:

Remote command execution failed:  ___  ___ _ _

Not even a reason why it failed, just a lot of underscores!

I preferred NRPE from the beginning anyway, so I've always used that.


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Nagios-users mailing list
Nagios-users@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


Re: [Nagios-users] Using SSH to run remote command checks

2007-02-16 Thread Robert Smith
Make sure that your SSHD allows the number of processes to be spawned
that you need.

I have:
MaxStartups 100

in my /etc/ssh/sshd_config which allows me to use my ssh gateway to
check up to 100 service concurrently with Nagios.

(you may need an updated version of openssh. get it from
ftp.openbsd.org/pub/OpenSSH/portable/)

I prefer to stay away from NRPE on unix systems.

Cheers,

-Robert Smith

Nagios Mail wrote:
 I wanted to update this problem as it appears to have never been
 resolved. The current version of check_by_ssh still returns an
 UKNOWN status in nagios. I have ran the command manually from the
 command line and echoed $?, and while it does return 0, nagios is
 putting in an UNKNOWN status. Not only that but the status appears to
 be flapping.

 The Critical and Warning status appear to work every time, but when an
 OK status is returned from one of the check programs (check_load,
 check_disk, check_process), check_by_ssh returns an UNKNOWN almost 80%
 of the time.

 I've followed up with three different people on this list who have
 reported the problem, and all of them just decided to move to NRPE.

 Has anyone gotten this plugin to work? I am assuming this is a code
 problem with check_by_ssh



 On 12/22/05, *Demetri Mouratis* [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:

 On Thu, 22 Dec 2005, [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:

  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{
   namecheck_adminserver
   service_description AdminServer
   use hg.prod.check_5min
   hosthost1,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_namecheck_command_ssh
   command_line/usr/bin/ssh -l nagios $HOSTADDRESS$ $ARG1$
  }
 If you are trying to ssh to another server and kick off the
 command there
 use check_by_ssh as follows:

 # check-remote-load
 define command{
  command_namecheck-remote-load
  command_line$USER1$/check_by_ssh -H $HOSTADDRESS$ -C
 $USER1$/check_load -w $ARG1$ -c $ARG2$
  }

 In your example, put the chkAdminServer.pl scripts in the nagios
 plugins
 directory on the target, e.g. /usr/lib/nagios/plugins then set the
 $USER1$
 variable to the same.  Then, su - nagios of your nagios box and
 ssh target
 /usr/lib/nagios/plugins/chkAdminServer.pl.


 ---
 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_id=7637alloc_id=16865op=click
 http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click
 ___
 Nagios-users mailing list
 Nagios-users@lists.sourceforge.net
 mailto:Nagios-users@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


 

 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your
 opinions on IT  business topics through brief surveys-and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
 

 ___
 Nagios-users mailing list
 Nagios-users@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


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV

RE: [Nagios-users] Using SSH to run remote command checks

2005-12-22 Thread Marc Powell


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:nagios-users-
 [EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
 Sent: Thursday, December 22, 2005 8:46 AM
 To: nagios-users@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{
   namecheck_adminserver
   service_description AdminServer
   use hg.prod.check_5min
   hosthost1,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_namecheck_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_namecheck_command_ssh
  command_lineecho /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_idv37alloc_id865op=click
___
Nagios-users mailing list
Nagios-users@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


RE: [Nagios-users] Using SSH to run remote command checks

2005-12-22 Thread Mark.Law
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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marc
Powell
Sent: Thursday, December 22, 2005 12:07 PM
To: nagios-users@lists.sourceforge.net
Subject: RE: [Nagios-users] Using SSH to run remote command checks



 -Original Message-
 From: [EMAIL PROTECTED] [mailto:nagios-users-
 [EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
 Sent: Thursday, December 22, 2005 8:46 AM
 To: nagios-users@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{
   namecheck_adminserver
   service_description AdminServer
   use hg.prod.check_5min
   hosthost1,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_namecheck_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_namecheck_command_ssh
  command_lineecho /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_idv37alloc_id865op=ick
___
Nagios-users mailing list
Nagios-users@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_idv37alloc_id865op=click
___
Nagios-users mailing list
Nagios-users@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