check_by_ssh help

Waynn Lue waynnlue at gmail.com
Mon May 25 07:55:02 CEST 2009


I'm trying to set up check_by_ssh to run a php script on a remote machine
that acts as a Nagios plugin.  The script runs a few ls commands to figure
out the number of directories in a subdirectories, then gives output and
return codes accordingly (if it's past a certain threshold, I wantit to
error).  I've setup an SSH key so that I can ssh into the machine to run the
ls command.

host1 has the nagios install, so it's where I run check_by_ssh from.  host2
is where the php script is installed.

Here's the command_line definition in the command definition
/usr/local/nagios/libexec/check_by_ssh -H host2 -l user -C "$ARG1$"'

Here's the check_command in the service definition
check_by_ssh_host2!/usr/local/bin/php /root/scripts/php_script.php

I changed the php script to just do

echo "DIRS CRITICAL\n";
return 2;

But all I get is "(null)" in the email sent from nagios, which implies to me
that it's not even running the script.  When I run the libexec/check_by_ssh
line from the command line, it correctly works.  How can I debug why it
isn't working within the Nagios framework?

As a gut check, how do I check what $USER the script is running as?  I'm
assuming "nagios" currently, which is how I've set up the SSH keys.

Thanks for any help!

Waynn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20090524/c93afcd8/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
-------------- next part --------------
_______________________________________________
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