Syntax Command Check_netstat_conn

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
ednaldojta
Posts: 103
Joined: Tue Apr 07, 2015 7:52 am

Re: Syntax Command Check_netstat_conn

Post 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.
You do not have the required permissions to view the files attached to this post.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Syntax Command Check_netstat_conn

Post 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.
Former Nagios Employee
ednaldojta
Posts: 103
Joined: Tue Apr 07, 2015 7:52 am

Re: Syntax Command Check_netstat_conn

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Syntax Command Check_netstat_conn

Post 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".

Code: Select all

scp id_rsa.pub [email protected]:/home/nagios/.ssh/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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
ednaldojta
Posts: 103
Joined: Tue Apr 07, 2015 7:52 am

Re: Syntax Command Check_netstat_conn

Post by ednaldojta »

Then the nagios user sets the remote machine is no password?
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Syntax Command Check_netstat_conn

Post 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
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
ednaldojta
Posts: 103
Joined: Tue Apr 07, 2015 7:52 am

Re: Syntax Command Check_netstat_conn

Post 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?
ednaldojta
Posts: 103
Joined: Tue Apr 07, 2015 7:52 am

Re: Syntax Command Check_netstat_conn

Post 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'.
You do not have the required permissions to view the files attached to this post.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Syntax Command Check_netstat_conn

Post 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! :D
Former Nagios Employee
ednaldojta
Posts: 103
Joined: Tue Apr 07, 2015 7:52 am

Re: Syntax Command Check_netstat_conn

Post 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.
You do not have the required permissions to view the files attached to this post.
Locked