Page 2 of 5
Re: Syntax Command Check_netstat_conn
Posted: Thu Mar 10, 2016 7:53 am
by ednaldojta
I already created a Nagios user on the remote machine. Below them as they are the permissions of files and SSH or file that I want to run on the remote machine.
Re: Syntax Command Check_netstat_conn
Posted: Thu Mar 10, 2016 10:57 am
by rkennedy
I ran into a similar issue when I tested this. From the .ssh folder, run chown nagios:nagios . - this should fix it.
Also - just to verify - did you set a password for the nagios user on the remote machine?
Let me know the result.
Re: Syntax Command Check_netstat_conn
Posted: Fri Mar 11, 2016 6:54 am
by ednaldojta
Good morning mate!
I did the following step-by-step.
I created a Nagios user on the remote machine and set a password for it.
I could not carry out the execution of the command
"Ssh-copy-id ~ / .ssh / id_rsa.pub [email protected]" because the result of this command is as follows:
ssh: Could not resolve hostname /home/nagios/.ssh/id_rsa.pub: Temporary failure in name resolution
So I copied via scp to id_rsa key, id_rsa.pub to the remote machine.
Since then I can not connect via ssh Nagios (10.10.60.51) to the remote host (10.10.60.52) with Nagios user of the remote machine.
However I can not perform the check via check_by_ssh, reports the following message.
Critical - plugin time out after 10 seconds
[email protected]'s password:
[email protected]'s password:
Note: I already realized chown nagios: nagios /home/nagios/.ssh
and also in the file.
is to solve this friend? Help me.
Re: Syntax Command Check_netstat_conn
Posted: Fri Mar 11, 2016 11:51 am
by lmiltchev
Here's what I did:
1. Copied the "check_netstat_conn.sh" script to the "/usr/local/nagios/libexec/" directory on the remote box.
2. Copied the public key from my XI box to the remote machine as "authorized_keys".
3. Made sure the permissions of the files in the "/home/nagios/.ssh" directory on the remote machine are correct. Here's what I have:
Code: Select all
ls -la /home/nagios/.ssh
total 20
dr-xr-xr-x 2 nagios nagios 4096 Mar 11 10:30 .
dr-xr-xr-x. 5 nagios nagios 4096 Nov 9 11:30 ..
-rw------- 1 nagios users 410 Mar 11 10:30 authorized_keys
-rw------- 1 nagios users 1671 Nov 9 11:30 id_rsa
-rw-r--r-- 1 nagios users 410 Nov 9 11:30 id_rsa.pub
4. Tested the passwordless log in to the remote machine from the Nagios XI server.
Code: Select all
su nagios
[nagios@localhost root]$ ssh [email protected]
Last login: Fri Mar 11 10:35:20 2016 from y.y.y.y
[nagios@localhost root]$ /usr/local/nagios/libexec/check_by_ssh -H x.x.x.x -C "/usr/local/nagios/libexec/check_netstat_conn.sh"
OK: 5|count=5
Hope this helps.
Re: Syntax Command Check_netstat_conn
Posted: Fri Mar 11, 2016 1:56 pm
by ednaldojta
Then the nagios user sets the remote machine is no password?
Re: Syntax Command Check_netstat_conn
Posted: Fri Mar 11, 2016 2:48 pm
by jolson
Then the nagios user sets the remote machine is no password?
The Nagios user will be logged in without being prompted for a password. This is typically referred to as key-based auth.
https://www.digitalocean.com/community/ ... nux-server
Re: Syntax Command Check_netstat_conn
Posted: Fri Mar 18, 2016 6:27 am
by ednaldojta
Good morning friends!
I managed to perform SSH connection without password with Nagios User.
Now when I run the plugin / usr / local / nagios / libexec / check_by_ssh - H 10.10.60.52 -C "command" the following message appears.
CRITICAL - Plugin timed out after 10 seconds
what's up?
Re: Syntax Command Check_netstat_conn
Posted: Fri Mar 18, 2016 8:20 am
by ednaldojta
Updating, I managed to perform the verification via ssh, as in the picture attached. However I just can it starting CLI, when I set up the command in NagiosXI it returns me the following error.
NagiosXI
COMMAND: /usr/local/nagios/libexec/check_by_ssh -H 10.10.60.52 -C "/usr/local/nagios/libexec/check_users -w 5 -c 10" -t 120
OUTPUT: Remote command execution failed: Could not create directory '/var/www/.ssh'.
Re: Syntax Command Check_netstat_conn
Posted: Fri Mar 18, 2016 10:36 am
by rkennedy
NagiosXI
COMMAND: /usr/local/nagios/libexec/check_by_ssh -H 10.10.60.52 -C "/usr/local/nagios/libexec/check_users -w 5 -c 10" -t 120
OUTPUT: Remote command execution failed: Could not create directory '/var/www/.ssh'.
Just to clarify - is this from the test check command? What is the actual result in the Nagios interface?
Looks like we're making progress!

Re: Syntax Command Check_netstat_conn
Posted: Fri Mar 18, 2016 11:50 am
by ednaldojta
HEHH: D
but we are making progress, and I appreciate until the time for help.
Regarding the results in Nagios screen. Appears the following mensagem.Segue screen attached.
Here also as is the configuration of the Nagios configuration in wizards.