Skip to content

RTFM · Healthchecks

lb.saphira.sendexpect.udp: ask a datagram, demand an answer

The UDP twin of the escape hatch: send your payload as a datagram, demand a matching reply, and treat an ICMP refusal as the vote it is. The honest way to health-check request/reply UDP protocols nobody named a check for.

Saphira Linux dragon mascot

What it proves

A request/reply exchange over UDP: payload out (SEND / SEND_HEX / SEND_FILE), reply accumulated, regex matched within the timeout. An ICMP port- or host-unreachable during the exchange fails the check immediately; the network itself testified that nothing is listening.

How it works

The probe engine's sendexpect probe in UDP mode on a connected socket: the reply must arrive before the deadline and match LB_SAPHIRA_EXPECT (accumulated across datagrams, latin-1, DOTALL). LB_SAPHIRA_DELAY applies between bind and send.

Configuration

Knobs
VariableDefaultMeaning
LB_SAPHIRA_SEND / SEND_HEX / SEND_FILE(required)The datagram payload
LB_SAPHIRA_EXPECT(required)Regex the reply must match
LB_SAPHIRA_DELAY0Seconds before send
LB_SAPHIRA_TIMEOUT3Exchange deadline
(target port)$4, else $2Any UDP port

Wiring it up

ldirectord
# ldirectord.cf - telemetry collector pool
virtual = 203.0.113.10:5140
    protocol = udp
    scheduler = rr
    real = 192.168.20.150:5140 gate 1
    checktype = external
    checkcommand = "/var/lib/lb/saphira/lb.saphira.sendexpect.udp"

Run it by hand

Manual run
LB_SAPHIRA_SEND_HEX='00 01 02' LB_SAPHIRA_EXPECT='^ACK' \
  /var/lib/lb/saphira/lb.saphira.sendexpect.udp telem 5140 192.168.20.150 5140
echo $?
# 0 = reply matched
# 1 = ICMP unreachable, timeout, or reply never matched
# 2 = payload or expect missing

Failure modes

  • Immediate refusal: ICMP port-unreachable: definitively nothing bound
  • Timeout: silent listener or silent firewall: both unhealthy, and the docs say so plainly

Did we miss something?

If this page left something unanswered, found an error, or there is another subject you would like documented, tell us. Saphira’s documentation grows from real problems people need to solve.

Send feedback or request a new section →

Prefer not to do it yourself?

Everything needed to do the work yourself is documented here and remains free; we charge for human time, not for withholding knowledge. Sometimes the missing resource is simply time. The same people who build Saphira can provide paid professional help with implementation, migration, troubleshooting and administration.

Ask about professional support →