Add a consistency report across IPAM, DNS and servers
New Consistency page listing where the three places this app records what lives at an address disagree: - Address conflicts: the same address reported by more than one server. - DNS out of date: a record named after a server (its hostname, or its short name) that points at an address the server doesn't report. - IPAM out of date: an entry labelled with a server's name at an address the server doesn't report. - Not in IPAM: addresses a server reports or DNS points at that IPAM doesn't list, merged into one finding per address, with a one-click "Add to IPAM" that pre-fills a label. - No DNS record: server LAN addresses no cached A/AAAA record resolves to. It compares data the app already holds and fetches nothing when opened, so the page states how many servers had reported addresses and how many DNS zones are synced (and how old the oldest sync is) -- DNS records are only cached for zones that have been synced, and a report that silently treated missing data as "no records" would mislead. Rules chosen to keep it from crying wolf: - Only private addresses are compared; public DNS records aren't expected to be in IPAM. - Servers with no reported addresses are never judged. - Agents report IPv4 only, so records are only compared within an address family (an AAAA record isn't "stale" for lacking an IPv6 address). - Docker bridge networks (172.16/12) are ignored: shared ones aren't conflicts, and they aren't listed unless someone put them in DNS. - Tailscale addresses don't need DNS records (MagicDNS), and IPAM entries kept current by the Tailscale/Proxmox syncs aren't second-guessed. Findings anyone has decided are fine can be ignored (operators) with a reason. An ignore is keyed on the finding's stable identity so it stays ignored across runs, its stored text comes from the finding rather than the request, and it is marked "no longer occurring" once the condition goes away. Ignore/restore are audit-logged. New table consistency_ignores (migration 0012). portScan's private-address helper is now exported and shared. Verified with 36 checks (each rule and its exclusions, address-family and case/trailing-dot handling, IPv6 case, ordering, stable keys, the report route including a garbled agent report, source counts, ignore/unignore rules and audit entries) and by driving the page against the real routers in a browser: Add to IPAM actually created the entry, ignore and restore, severity filter, "show all", the viewer view, and narrow-width layout (which found and fixed a squeezed badge and clipped buttons). Real dev database mtime untouched. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ca0fa817f8
commit
2352689fd3
13 files changed
+2246
-1
No files matched your search
@@ -513,6 +513,43 @@ export interface DomainList {
|
||||
checking: boolean;
|
||||
}
|
||||
|
||||
export type ConsistencyKind = "ip_conflict" | "dns_stale" | "ipam_stale" | "not_in_ipam" | "no_dns";
|
||||
export type ConsistencySeverity = "error" | "warning" | "info";
|
||||
|
||||
export interface ConsistencyFinding {
|
||||
key: string;
|
||||
kind: ConsistencyKind;
|
||||
severity: ConsistencySeverity;
|
||||
title: string;
|
||||
detail: string;
|
||||
ip: string | null;
|
||||
servers: { id: number; name: string }[];
|
||||
dnsNames: string[];
|
||||
suggestedLabel: string | null;
|
||||
}
|
||||
|
||||
export interface ConsistencyIgnore {
|
||||
id: number;
|
||||
key: string;
|
||||
title: string;
|
||||
reason: string | null;
|
||||
createdBy: string | null;
|
||||
createdAt: string;
|
||||
stillPresent: boolean;
|
||||
}
|
||||
|
||||
export interface ConsistencyReport {
|
||||
findings: ConsistencyFinding[];
|
||||
counts: Record<ConsistencySeverity, number>;
|
||||
ignored: ConsistencyIgnore[];
|
||||
sources: {
|
||||
servers: { total: number; withAddresses: number };
|
||||
ipam: number;
|
||||
dns: { zones: number; syncedZones: number; records: number; oldestSyncedAt: string | null; newestSyncedAt: string | null };
|
||||
};
|
||||
generatedAt: string;
|
||||
}
|
||||
|
||||
export interface DockhandContainer {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -877,6 +914,12 @@ export const api = {
|
||||
remove: (id: number, portId: number) => request<void>(`/api/servers/${id}/ports/${portId}`, { method: "DELETE" }),
|
||||
},
|
||||
},
|
||||
consistency: {
|
||||
report: () => request<ConsistencyReport>("/api/consistency"),
|
||||
ignore: (key: string, reason?: string) =>
|
||||
request<{ ignore: ConsistencyIgnore }>("/api/consistency/ignore", { method: "POST", body: JSON.stringify({ key, reason }) }),
|
||||
unignore: (id: number) => request<void>(`/api/consistency/ignore/${id}`, { method: "DELETE" }),
|
||||
},
|
||||
domains: {
|
||||
list: () => request<DomainList>("/api/domains"),
|
||||
add: (name: string) =>
|
||||
|
||||
Reference in new issue
Block a user