Page 1 of 2

Monitoring hosts using ssh quick test?

Posted: Thu Oct 05, 2017 1:18 pm
by ikekim
Monitoring hosts using ssh quick test?

I've downloaded and installed the Nagios official plugin (nagios-plugins-2.2.1.tar.gz) on a Redhat host machine.

From Nagios XI server command prompt, I run this command to do a quick test:

/usr/local/nagios/libexec/check_by_ssh -H 10.155.20.60 -C uptime -l testuser1

This gives me the error "Remote command execution failed"

When I run this command targeting another Redhat host machine, it works by returning an expected response.

Is there a test that I can do on the remote machine itself to verify if the plugin is correctly installed and working?

thanks,
ik

Re: Monitoring hosts using ssh quick test?

Posted: Thu Oct 05, 2017 1:26 pm
by eloyd
check_by_ssh doesn't require anything installed on the remote machine other than to be able to connect via SSH. So try this from your Nagios host (make sure you're su'ed to the nagios user, not testing as root):

Code: Select all

ssh <remote host> uptime
If that doesn't work, you'll need to fix things there, first.

Re: Monitoring hosts using ssh quick test?

Posted: Thu Oct 05, 2017 2:01 pm
by ikekim
@eloyd,

thanks, I did this command and works without password prompt and I get a successful response:

ssh [email protected] uptime

So what would be the best way for me to troubleshoot the target host which has the 50 official nagios plugins, specifically with this command:

/usr/local/nagios/libexec/check_by_ssh -H 10.155.20.60 -C uptime -l testuser1

Re: Monitoring hosts using ssh quick test?

Posted: Thu Oct 05, 2017 2:06 pm
by eloyd
Does it just say "remote execution failed" or does it also provide some additional information?

Re: Monitoring hosts using ssh quick test?

Posted: Thu Oct 05, 2017 2:21 pm
by ikekim
Yes, not much detail on the error message - here is the complete message.

[nagios@null-0800270406a2 root]$ /usr/local/nagios/libexec/check_by_ssh -H 10.155.20.60 -C "/usr/local/nagios/libexec/check_disk /" -l testuser1
Remote command execution failed: Welcome to rhel-s24me.dev.abcd.cloud.xyz.com!


thanks,
ik

Re: Monitoring hosts using ssh quick test?

Posted: Thu Oct 05, 2017 2:46 pm
by eloyd
Does testuser1 on 10.155.20.60 have some sort of restricted shell or locked password or some such security thingy?

Re: Monitoring hosts using ssh quick test?

Posted: Thu Oct 05, 2017 3:02 pm
by ikekim
I'm guessing it does. The target host is managed by another team and uses SALT for configuring the system and is residing on a separate network and I don't have the knowledge of what is being restricted so it is hard for me to troubleshoot.

That is why if I can isolate the problem by running some sort of test from the target host itself and hoping that can reveal the root cause is.

Since the plugins are installed on the target host, is there a way for me to execute some command that will show that check_by_ssh plugin is working?


thanks,
ik

Re: Monitoring hosts using ssh quick test?

Posted: Thu Oct 05, 2017 3:09 pm
by eloyd
Well, if you do this on your Nagios host (assuming you start as the root user), it will prove something's weird on the other side or not:

Code: Select all

# su - nagios
# ssh -l testuser1 10.155.20.60 "/usr/bin/uptime"
If that works, then something wonky is going on with Nagios. If that doesn't work, then something wonky is going on with the remote system.

Re: Monitoring hosts using ssh quick test?

Posted: Thu Oct 05, 2017 3:17 pm
by dwhitfield
Thanks @eloyd!

Re: Monitoring hosts using ssh quick test?

Posted: Thu Oct 05, 2017 3:44 pm
by ikekim
If I'm understanding you correctly, I'm executing these commands on the Nagios XI server command line:

[root@null-0800270406a2 ~]# su - nagios
[nagios@null-0800270406a2 ~]$ ssh -l testuser1 10.155.20.60 "/usr/bin/uptime"

This host is managed by SaltStack!
16:39:04 up 20 days, 11:30, 1 user, load average: 0.28, 0.14, 0.08

This works - so what would be the reason this working leads to the conclusion "something wonky is going on with Nagios"?

thanks,
ik