watcher: a removed nameserver is an NS Change, not an NS Failure (closes #262)
check / check (push) Canceled after 0s

A nameserver that left a domain's delegation was reported twice: as the
domain's NS Change, and by the check of the domain's own records as an
error-level NS Failure saying it disappeared. That check now sends
nothing for a domain. For a hostname, the nameservers that leave its
zone are sent as one NS Change at warning level, with a Hostname: line
and a Removed: line, as decided on the issue; nothing is sent for one
that joins. The README says what each case gets.

A nameserver that was failing before it left is now listed too; the
NS Failure skipped it.
A domain with no delegation of its own gets nothing when a nameserver
leaves the zone it is in.

Model: opus-5-5
This commit is contained in:
2026-10-13 11:27:04 +00:00
parent e8b40062da
commit 79ab40a87b
5 changed files with 89 additions and 30 deletions
+33 -16
View File
@@ -772,28 +772,45 @@ func (w *Watcher) detectRecordChanges(
}
}
// detectNSDisappearances sends one NS Change for a hostname, listing
// the nameservers of the previous check that are no longer those of its
// zone. Nothing is sent for a configured apex domain, whose removed
// nameservers detectNSChanges notifies.
func (w *Watcher) detectNSDisappearances(
ctx context.Context,
hostname string,
prev, current *state.HostnameState,
) {
for ns, prevNS := range prev.RecordsByNameserver {
if _, ok := current.RecordsByNameserver[ns]; ok || prevNS.Status != statusOK {
continue
}
msg := fmt.Sprintf(
"%s\nNameserver: %s disappeared",
w.nameLine(hostname), ns,
)
w.notify.SendNotification(
ctx,
"NS Failure: "+hostname,
msg,
"error",
)
if w.isDomain(hostname) {
return
}
var removed []string
for ns := range prev.RecordsByNameserver {
if _, ok := current.RecordsByNameserver[ns]; !ok {
removed = append(removed, ns)
}
}
if len(removed) == 0 {
return
}
slices.Sort(removed)
msg := fmt.Sprintf(
"Hostname: %s\nRemoved: %s",
hostname,
strings.Join(removed, ", "),
)
w.notify.SendNotification(
ctx,
"NS Change: "+hostname,
msg,
"warning",
)
}
// detectNSFailures notifies when a nameserver that answered on the