Hello Miguel,
In our checkcommands.cfg file we have:

command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ -t 60 -n $HOSTNAME$ -s check_sda1_by_ssh -C '/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/sda1'

and in our services.cfg we have:

# Check sda1 by ssh Service Definition Template
define service{
        name                            check_sda1_by_ssh
        service_description             Check_sda1_by_ssh
        check_command                   check_sda1_by_ssh
        use                             generic-service

        contact_groups                  support
        notification_interval           0
        notification_period             workhours
notification_options c,f ; Critical, Flapping register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
        }

define service{
use check_sda1_by_ssh ; Name of service template to use
        host_name                       megarouter
        }


and it works successfully.

How are you referencing it in your services.cfg file i.e. what are you using for the check_command?

cheers, Tim

Miguel Faria wrote:
This is a problem that I've been having for quite some time. Searching
the archives turns up a few other people reporting the same problem, but
I can't find a solution.

I am trying to use check_by_ssh to run the check_disk plugin on a few
remote systems. When I run this from the command line, it always does
the right thing. It returns the correct string and return code (checked
with 'echo $?'). It works flawlessly.

However, when this is set up to run through Nagios, it usually reports
the check in the UNKNOWN state...even though it still gives the correct
"OK..." string. Occasionally, Nagios will change it to OK or WARNING or
whatever is correct at the time, but for a good 90% of the time, it just
sits there in UNKNOWN. It doesn't seem to matter if the target machine
is Linux or Solaris, nor can I find any pattern to when and where it
happens. Again, it *always* works perfectly when run from the command
line.

I've played with giving check_by_ssh a hostname instead of an IP
address. I've tried it both with '-l nagios' and without (it's always
run from nagios account). I've also tried the -f flag (the purpose of
which I don't really understand). Nothing seems to help. For the time
being, I'm just running an SNMP client to get this info into Nagios, but
I'd really rather use check_by_ssh if at all possible.

Has anyone else seen this problem and/or found the cause of it?

Here's the exact command I'm using on the command line. This same thing
is configutred in my .cfg file.

check_by_ssh -H 192.168.230.112 -C
'/home/utils/nagios/libexec/check_disk -w 10% -c 5% -p /var'

Thanks!




-------------------------------------------------------
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=7637&alloc_id=16865&op=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

Reply via email to