Linux Network Traffic Monitoring

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Linux Network Traffic Monitoring

Post 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..
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Linux Network Traffic Monitoring

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Re: Linux Network Traffic Monitoring

Post 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
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: Linux Network Traffic Monitoring

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Re: Linux Network Traffic Monitoring

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Linux Network Traffic Monitoring

Post by scottwilkerson »

You need to add the -p

Code: Select all

/usr/local/nagios/libexec/check_tcp -H lxxxv -p 9094
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Re: Linux Network Traffic Monitoring

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Linux Network Traffic Monitoring

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked