Page 1 of 1
Linux Network Traffic Monitoring
Posted: Fri Aug 16, 2019 3:14 pm
by naranant
Hello,
Need help in setting up a monitoring a linux host along with the port number from nagios server and alert whenever it is not accessible. Below is the command need to use for monitoring. Please let me know the relevant nrpe command to use for monitoring this.
nc -vz hostname 9094
Regards..
Re: Linux Network Traffic Monitoring
Posted: Mon Aug 19, 2019 8:38 am
by tgriep
To check for an open port on a system, you can use the check_tcp plugin.
For your example, you would use the following to test for the port 9094 on the hostname.
Code: Select all
/usr/local/nagios/libexec/check_tcp -H hostname -p 9094
In the NRPE agent's config files, you would create a command like the following.
Code: Select all
command[check_tcp]=/usr/local/nagios/libexec/check_tcp -H $ARG1$
Then to use the NRPE command from the Nagios server, you would do this.
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H NRPEHost -c check_tcp -a 'hostname -p 9094'
Let us know if you have any questions.
Re: Linux Network Traffic Monitoring
Posted: Mon Aug 19, 2019 11:45 am
by naranant
Hello,
I did the following steps.
command[check_tcp]=/usr/local/nagios/libexec/check_tcp -H $ARG1$ - This was updated the nrpe.cfg
Created a command in the nagios with below command
/usr/local/nagios/libexec/check_nrpe -H NRPEHost -c check_tcp -a 'hostname -p 9094'
and when i try to execute the commmand in the nagios server i get the attached error
Re: Linux Network Traffic Monitoring
Posted: Mon Aug 19, 2019 1:07 pm
by tgriep
You have a typo in the command. The name of the plugin does not end in a number one "1" so remove that from the command.
Re: Linux Network Traffic Monitoring
Posted: Tue Aug 20, 2019 8:12 am
by naranant
Ok. i correct the command and getting the below message when i execute the command.
/usr/local/nagios/libexec/check_tcp -H lxxxv 9094
connect to address lxxxv and port 0: No route to host
How do i use the nc in the syntax as i have requirement to run the below command
nc -vz hostname 9094
Re: Linux Network Traffic Monitoring
Posted: Tue Aug 20, 2019 8:47 am
by scottwilkerson
You need to add the
-p
Code: Select all
/usr/local/nagios/libexec/check_tcp -H lxxxv -p 9094
Re: Linux Network Traffic Monitoring
Posted: Tue Aug 20, 2019 2:43 pm
by naranant
Hello Scott,
Sorry to miss that it works i see a response to continue on this how do i use nc(netcat) command along with this
Re: Linux Network Traffic Monitoring
Posted: Tue Aug 20, 2019 2:48 pm
by scottwilkerson
naranant wrote:Hello Scott,
Sorry to miss that it works i see a response to continue on this how do i use nc(netcat) command along with this
I don't understand how you want to use nc(netcat) with a check_tcp
nc is for sending data to a port, I'm not sure how you are going to get any response that can be used in a nagios check.
What is your desired output?
What would be a failure?
The check_tcp command should give you equal information as the -vz flag of nc