check_by_ssh

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
vburshteyn
Posts: 2
Joined: Tue Apr 15, 2014 1:38 pm

check_by_ssh

Post by vburshteyn »

Hello All,

Please note that I am a Nagios newb so please be gentle! :)

I have establish an key connection to the remote server and abble to SSH in with out pws.

I am also able to execute commands in CLI:
/usr/local/nagios/libexec/check_by_ssh -E 1 -l vi-admin -H x.x.x.x -C "~/box293_check_vmware.pl --server y.y.y.y --check vCenter_Name_Version"
this command return a valid response.

When I run this from Nagios:
/usr/local/nagios/libexec/check_by_ssh -l vi-admin -H x.x.x.x $ARG1$
$ARG1$ = -C "~/box29vmware.pl --server y.y.y.y --check vCenter_Name_Version"
I get
TEST: OUTPUT: Remote command execution failed: Could not create directory '/var/www/.ssh'.
and Remote command execution failed.

Any tips would be appreciated.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_by_ssh

Post by sreinhardt »

When you ran this via cli what user were you? Also I would highly suggest against using the test command button. It runs from apache via a php file as the apache user, which is quite separate from the nagios user. Specifically for check_by_ssh it would need a ~/.ssh folder with a ssh key for the apache user to login password-less, which I am guessing is not likely there.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
vburshteyn
Posts: 2
Joined: Tue Apr 15, 2014 1:38 pm

Re: check_by_ssh

Post by vburshteyn »

i ran the command as a nagios user.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_by_ssh

Post by sreinhardt »

OK great! So if you save that service and apply configuration, so that nagios is restarted with that command and service. What happens with it, does it check correctly?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_by_ssh

Post by Box293 »

I think the problem is in your command definition or service definition.

The command in the command defintion should be:

Code: Select all

define command {
command_name box293_check_vmware
command_line $USER1$/check_by_ssh -E 1 -t 90 -l vi-admin -H x.x.x.x -C "~/box293_check_vmware.pl --server $ARG1$ --check $ARG2$ \"$ARG3$\" \"$ARG4$\" \"$ARG5$\" \"$ARG6$\" \"$ARG7$\" \"$ARG8$\""
}
Where x.x.x.x is the IP address of your vMA server

And the check command in your service definition should be:

Code: Select all

check_command box293_check_vmware!y.y.y.y!vCenter_Name_Version!!!!!!
Where:
  • $ARG1$ = y.y.y.y
    $ARG2$ = vCenter_Name_Version
Does this help?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked