Page 1 of 2

check udp port

Posted: Wed Oct 18, 2017 6:12 am
by DOkuwa
hello
I am checking the specific port 19523 on a red hat Linux server and I am not getting a notification when the port is down by stopping a service
I think the argument is wrong
I am sending the config file and screenshot by attachment

Code: Select all

[/###############################################################################
#
# Service configuration file
#
# Created by: Nagios Core Config Manager 2.6.9
# Date:	      2017-10-18 11:09:07
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios CCM will overwrite all manual settings during the next update if you 
# would like to edit files manually, place them in the 'static' directory or 
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define service {
	host_name			dev-smarts-01.exp001.exponential-e.net.
	service_description		dev-te-01
	use				xiwizard_udp_service
	check_command			check_udp!-p 19523 !!!!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		10
	notification_period		xi_timeperiod_24x7
	contacts			nagiosadmin
	_xiwizard			tcpudpport
	register			1
	}	

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
code]

Re: check udp port

Posted: Wed Oct 18, 2017 11:57 am
by kyang
The check_udp is going to be expecting a string to pass and receive.

Code: Select all

[-s <send string>]
[-e <expect string>]
If you are just wanting to check the port for a connection then the check_tcp is probably more suitable.

Code: Select all

/usr/local/nagios/libexec/check_tcp -H 192.168.4.125 -p 5666
TCP OK - 0.000 second response time on 192.168.4.125 port 5666|time=0.000410s;;;0.000000;10.000000

Code: Select all

/usr/local/nagios/libexec/check_tcp -H 192.168.4.125 -p 81
connect to address 192.168.4.125 and port 81: No route to host

Re: check udp port

Posted: Wed Oct 18, 2017 12:05 pm
by DOkuwa
This worked from the command line
/usr/local/nagios/libexec/check_tcp -H 10.241.11.203 -p 19523
TCP OK - 0.000 second response time on 10.241.11.203 port 19523|time=0.000112s;;;0.000000;10.000000
how does this configured as an alert on Nagios XI windows GUI
please tell me how

Re: check udp port

Posted: Wed Oct 18, 2017 12:19 pm
by kyang
Like this, I'm only checking my localhost for connection on port 81. It will fail because I don't have port 81 open or any connection.
port.PNG
This is on Port 80, which I do have a connection.
port80.PNG
Here is how I defined my check.
checklocal.PNG
Hope this helps!

Re: check udp port

Posted: Wed Oct 18, 2017 3:52 pm
by DOkuwa
thanks yes it helps
but also some of the ports are udp
how do we check for this

Re: check udp port

Posted: Wed Oct 18, 2017 4:03 pm
by dwhitfield
When you went through the wizard you did not set up a send/expect string.

You may have better luck with the following: https://exchange.nagios.org//directory/ ... rt/details

Re: check udp port

Posted: Thu Oct 19, 2017 11:23 am
by DOkuwa

Code: Select all

 ./check_udp -H 10.241.11.203 -p 19523 -w 60     -s "trap explorer is down" -e "port 19253 is down"
No data received from host
I am not sure why

Re: check udp port

Posted: Thu Oct 19, 2017 4:04 pm
by dwhitfield
What's the output of the following command? nmap -sU 10.241.11.203 -p 19523

Re: check udp port

Posted: Fri Oct 20, 2017 3:44 am
by DOkuwa
Thanks

Starting Nmap 6.40 ( http://nmap.org ) at 2017-10-20 09:43 BST
Nmap scan report for dev-smarts-01.exp001.exponential-e.net (10.241.11.203)
Host is up (0.00016s latency).
PORT STATE SERVICE
19523/udp closed unknown
MAC Address: 00:50:56:01:03:24 (VMware)

Nmap done: 1 IP address (1 host up) scanned in 0.07 seconds

Re: check udp port

Posted: Fri Oct 20, 2017 10:44 am
by dwhitfield
DOkuwa wrote: 19523/udp closed unknown
It doesn't look like anything is listening on that port.

What's the output of netstat -lu on that port? Are you sure this is one of the udp ports you need to be checking?