Search code examples
sshssh-keysnagios

Groundwork / Nagios' check_by_ssh is returning "Remote command execution failed"


I'm using Groundwork / Nagios, and I'm trying to set up check_by_ssh. Right now, the command is:

$USER1$/check_by_ssh -i ~nagios/.ssh/id_dsa -H $HOSTADDRESS$ -t 60 -l "$USER24$" -C "/tmp/test"

where /tmp/test is a Hello World program.

but it's returning the message "Remote command execution failed:********************************************"

I have ssh keys set up for nagios to log into $HOSTADDRESS$ as $USER24$, but I'm still getting the error. (The private key is in ~nagios/.ssh on the groundwork box, and the public key is in ~/$USER24$/.ssh on the remote host)

So basically, check_by_ssh is failing to run any program.


Solution

  • For some reason, adding the "-E" flag fixed it. According to the check_by_ssh man page, this is the ignore STDERR flag. Now I get the output from /tmp/test.

    Final command:

    $USER1$/check_by_ssh -i ~nagios/.ssh/id_dsa -H $HOSTADDRESS$ 
    -t 60 -l "$USER24$" -C "/tmp/test" -E
    

    Final output:

    Hello World