Syntax Command Check_netstat_conn

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Syntax Command Check_netstat_conn

Post by rkennedy »

I don't know how well it'll handle the |, can you create a one line bash script to do this on the remote machine, grant nagios permissions to run the file, and then try again?

I think having a wrapper script run the 3 commands you're looking for should work.
Former Nagios Employee
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Syntax Command Check_netstat_conn

Post by tgriep »

Can you login to the Nagios XI server, run the following and post the output?

Code: Select all

su nagios
/usr/local/nagios/libexec/check_by_ssh -H xxx.xxx.xxx.xxx -C "netstat -an |grep 5666| wc -l"
Replace xxx.xxx.xxx.xxx with the IP address of the remote host.
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 »

Kennedy I did not understand well, the fact is that the command looks like this with an estimated time of 60 seconds if the scan is not performed at this time, there's the time exhausted. Sera's that?
tgriep
the command line I can get the result I want. But Nagios dashboard I can not, of this message I posted in the previous post.

su nagios
[nagios@MFE-PROD-REL01 $]/usr/local/nagios/libexec/check_by_ssh -H 10.10.60.52 -C "netstat -an |grep 5666| wc -l" -t 120
1
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 »

What is the output of the following command?

Code: Select all

grep nag /etc/group
I set up a custom service, similar to yours and it seems to be working fine.
example01.PNG
example02.PNG
You do not have the required permissions to view the files attached to this post.
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 »

Hello Friend,
mine is equal to its setting, but it does not bring results. Below the image configuration.
You do not have the required permissions to view the files attached to this post.
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 »

Can you run the following command on the Nagios XI server, and show us the output?

Code: Select all

su -l nagios -c '/usr/local/nagios/libexec/check_by_ssh -H <remote ip> -C "netstat -an | grep 5666 | wc -l" -t 120'
Can you log in the remote box as nagios without password?

Code: Select all

su nagios
ssh nagios@remoteip
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 »

Yes! I can access without password! Ja configured certificates! So I can not bring results starting the graphical interface NagiosXI. Below is the output of the commands.
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Syntax Command Check_netstat_conn

Post by tgriep »

Can you login to the remote system as the nagios user and run the commands?

Code: Select all

netstat -an |grep 5666| wc -l
Are there any errors in the log files in /var/log on the remote system?
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 »

Griep,
I can access and bring all through the CLI results, which I can not bring it is starting the graphical interface of Nagios XI (Dashboards). I can carry out the command via SSH and locally on the remote machine.
You know what might be acontencendo, all the steps that you asked me now, since I made earlier.
Attached requested.


Ha, I do not know if it can help. But when I connect via SSH on the remote machine, it costs more than a minute to connect or bring results via SSH.
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Syntax Command Check_netstat_conn

Post by tgriep »

Thanks for the info.
The default service check timeout is causing the check to be terminated. This can be fixed by editing the nagios.cfg file.

Code: Select all

/usr/local/nagios/etc/nagios.cfg
and increasing this value to a larger number so it will not timeout.

Code: Select all

service_check_timeout=60
One way to find out how long the command takes it to add the time command. This will ell you how lond it ran and you can use that for the above settings.

Code: Select all

time /usr/local/nagios/libexec/check_by_ssh -H <remote ip> -C "netstat -an | grep 5666 | wc -l"
Try that and let us know if this works for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked