mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 11:46:35 +00:00
Run 32118850138 lost the :53 listener, so the sampler counts listeners. Run 32538854067 lost DNS with the listener still bound: sockets-udp.txt showed dnsmasq holding 0.0.0.0:53 while every forwarded query timed out, and the sampler reported that hour as healthy. Each tick now also records what a glibc caller gets back — for the zone this resolver owns, derived from its own address= line, and for one name it must forward — with the latency that caller paid. The rescue collector probes the in-zone name too: probing external names alone cannot separate "forwarding is gone" from "dnsmasq is gone". The sampler now also runs on the swarm lab DNS nodes; it only ever ran in the compose path, which is why the Magento artifact carried no sampler log at all. Its location comes from group_vars FILE_DNS53_SAMPLER_LOG and is required at every call site, so a run cannot quietly collect nothing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
49 lines
1.3 KiB
Bash
Executable File
49 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
# Run 32118850138 could bound the dnsmasq listener loss only to a 6m39s
|
|
# window between two host DNS consumers; one line per 10s pins it to one
|
|
# sample bucket and names which :53 listener (hex local_address) was left.
|
|
set -u
|
|
|
|
EXTERNAL_PROBE_NAME=deb.debian.org
|
|
|
|
sample_once() {
|
|
socks="$(awk '$2 ~ /:0035$/ && $3 == "00000000:0000" {printf " %s", $2}' "${1}")"
|
|
printf '%s%s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "${socks:- none}"
|
|
}
|
|
|
|
zone_probe_name() {
|
|
zone="$(sed -n 's|^[[:space:]]*address=/\([^/]*\)/.*|\1|p' "${1}" 2>/dev/null | head -n1)"
|
|
[ -n "${zone}" ] || return 0
|
|
printf 'rescue-probe.%s' "${zone}"
|
|
}
|
|
|
|
answer_once() {
|
|
name="${1}"
|
|
start="$(date -u '+%s%3N')"
|
|
if timeout 3 getent ahosts "${name}" >/dev/null 2>&1; then
|
|
verdict=ok
|
|
else
|
|
verdict=fail
|
|
fi
|
|
printf ' %s=%s/%sms' "${name}" "${verdict}" "$(($(date -u '+%s%3N') - start))"
|
|
}
|
|
|
|
[ "${DNS53_SAMPLER_LIB:-}" = "1" ] && return 0
|
|
|
|
: "${INFINITO_DNS53_SAMPLER_LOG:?INFINITO_DNS53_SAMPLER_LOG must be set}"
|
|
mkdir -p "$(dirname "${INFINITO_DNS53_SAMPLER_LOG}")"
|
|
while :; do
|
|
{
|
|
printf '%s' "$(sample_once /proc/net/udp)"
|
|
inzone="$(zone_probe_name /etc/dnsmasq.conf)"
|
|
if [ -n "${inzone}" ]; then
|
|
answer_once "${inzone}"
|
|
else
|
|
printf ' inzone=unconfigured'
|
|
fi
|
|
answer_once "${EXTERNAL_PROBE_NAME}"
|
|
printf '\n'
|
|
} >>"${INFINITO_DNS53_SAMPLER_LOG}"
|
|
sleep 10
|
|
done
|