udp — make UDP network connections

The udp check sends a network request over UDP and asserts that the response received, if any, is expected.

Examples

Check that a local UDP port responds when a packet is sent to it:

[[udp]]
port = 53

Check that a port does not respond:

[[udp]]
port = 53
state = 'no-response'

Check that a port on another machine responds:

[[udp]]
port = 53
address = '192.168.0.1'

Changing the source address

Sometimes, servers will bind to an address other than 0.0.0.0. To connect to these servers, you’ll need to send your packets from that source IP:

[[udp]]
port = 8301
source = '10.3.4.3'

If the application has been configured to listen on an interface, looking up its IP at runtime, then Specsheet can do the same to match it:

[[udp]]
port = 8301
source = '%eth1'

Checking the firewall

The ufw test type can be used to check whether firewall entries exist. It’s common to check that a port is open and that it’s allowed out by the firewall.

So common, in fact, that there’s a shortcut to check both at the same time. Use the ufw_allow property to test the range that this port is allowed in. This is usually the string “Anywhere”.

[[udp]]
port = 8301
ufw = { allow = 'Anywhere' }

List of parameters

parameterstructuredescription
addressstringThe address to send the request to.
portnumberPort number.
sourcestringThe network address or interface to send from.
statestringThe state of the port. This can be 'responds' or 'no-response'.
ufwtableUFW check options.