Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Addresses #1559
rcourtmanaefc631374c0
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 5016793a66..e03e1f3c96 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -1357,8 +1357,24 @@ AI-only summary payloads, or page-local heuristics.must not mint host canonical IDs from snapshot-content-dependentidentity subsets without consulting the pins, and pin writes stay onthe durable store-backed registry (ephemeral per-request registries- consult, never write). Regression coverage:- `internal/unifiedresources/canonical_id_pins_test.go`.+ consult, never write). Pinned hostnames preserve the full dotted name+ (`NormalizeFullHostname`): distinct machines that share a short+ hostname (`cloud.rnd-lax1` vs `cloud.gce-or1`) must keep distinct+ pins, distinct pin-index buckets, and distinct presentation host rows.+ Short-hostname normalization (`NormalizeHostname`) is a matching-only+ convenience: pin lookups and the presentation host coalescer may pair+ a short name with its own FQDN (`web01` vs `web01.lan`), but only+ through an unambiguous bucket whose pinned hostname is+ short/FQDN-equivalent (`HostnamesEquivalent`) to the incoming one;+ they must never rewrite a persisted hostname down to its short form+ or cross-match two different FQDNs. Pin rows persisted before this+ rule hold the collapsed short name and heal in place on the host's+ next pin persist, and `ResourceIdentityPin.EraIDs` derives both full-+ and short-hostname eras so journal rows recorded under short-hostname+ IDs stay readable. Regression coverage:+ `internal/unifiedresources/canonical_id_pins_test.go` and+ `TestStandaloneDottedHostnameAgentsStayDistinct` in+ `internal/unifiedresources/registry_test.go`.26. Keep action-audit origin metadata broker-owned. `ActionAuditRecord`carries an optional `Origin *ActionOrigin`(`surface`/`findingId`/`investigationId`/`proposalId`), persisted indiff --git a/internal/unifiedresources/canonical_id_pins_test.go b/internal/unifiedresources/canonical_id_pins_test.goindex 3788a4750f..02aa36df11 100644--- a/internal/unifiedresources/canonical_id_pins_test.go+++ b/internal/unifiedresources/canonical_id_pins_test.go@@ -74,91 +74,3 @@ func TestIdentityPinIndexLegacyCollapsedPinStillMatches(t *testing.T) {t.Fatalf("legacy collapsed pin should match its host's full hostname, got ok=%v pin=%q", ok, pin.CanonicalID)}}--// The end-to-end #1559 scenario: multiple standalone agents with dotted-// hostnames must mint distinct canonical resources, persist full dotted-// hostnames in their pins, and boot-window records that only know the-// hostname must resolve to the right machine instead of the first pin.-func TestStandaloneDottedHostnameAgentsStayDistinct(t *testing.T) {- store := NewMemoryStore()-- hosts := []struct {- hostname string- machineID string- }{- {"cloud.rnd-lax1", "machine-rnd"},- {"cloud.gce-or1", "machine-gce"},- {"cloud.dmi-lax1", "machine-dmi"},- }-- agentResource := func(hostname, machineID string) Resource {- return Resource{- Type: ResourceTypeAgent,- Name: hostname,- Status: StatusOnline,- Agent: &AgentData{AgentID: machineID, Hostname: hostname, MachineID: machineID},- }- }-- steady := NewRegistry(store)- idByHostname := make(map[string]string, len(hosts))- for _, host := range hosts {- identity := ResourceIdentity{MachineID: host.machineID, Hostnames: []string{host.hostname}}- id := steady.ingest(SourceAgent, host.machineID, agentResource(host.hostname, host.machineID), identity)- if id == "" {- t.Fatalf("agent ingest for %q returned no ID", host.hostname)- }- for hostname, existingID := range idByHostname {- if existingID == id {- t.Fatalf("hosts %q and %q collapsed to canonical ID %q", hostname, host.hostname, id)- }- }- idByHostname[host.hostname] = id- }- if got := len(steady.List()); got != len(hosts) {- t.Fatalf("expected %d distinct resources, got %d", len(hosts), got)- }- steady.PersistIdentityPins()-- pins, err := store.ListResourceIdentityPins()- if err != nil {- t.Fatalf("ListResourceIdentityPins: %v", err)- }- pinnedHostnames := make(map[string]struct{}, len(pins))- for _, pin := range pins {- pinnedHostnames[pin.Hostname] = struct{}{}- }- for _, host := range hosts {- if _, ok := pinnedHostnames[host.hostname]; !ok {- t.Fatalf("expected pinned primary hostname %q, got %v", host.hostname, pinnedHostnames)- }- }-- // Boot window: runtime records that only know the hostname (no machine- // ID yet) arrive before the agents. Each must complete from its own pin- // and land on its own canonical ID.- boot := NewRegistry(store)- for _, host := range hosts {- record := Resource{- Type: ResourceTypeAgent,- Name: host.hostname,- Status: StatusOnline,- Docker: &DockerData{HostSourceID: "docker:" + host.hostname, Hostname: host.hostname},- }- identity := ResourceIdentity{Hostnames: []string{host.hostname}}- id := boot.ingest(SourceDocker, "docker:"+host.hostname, record, identity)- if want := idByHostname[host.hostname]; id != want {- t.Fatalf("boot-window record for %q resolved %q, want its own canonical ID %q", host.hostname, id, want)- }- }- for _, host := range hosts {- identity := ResourceIdentity{MachineID: host.machineID, Hostnames: []string{host.hostname}}- id := boot.ingest(SourceAgent, host.machineID, agentResource(host.hostname, host.machineID), identity)- if want := idByHostname[host.hostname]; id != want {- t.Fatalf("agent ingest for %q resolved %q, want %q", host.hostname, id, want)- }- }- if got := len(boot.List()); got != len(hosts) {- t.Fatalf("expected %d merged resources after boot-window ingest, got %d", len(hosts), got)- }-}diff --git a/internal/unifiedresources/registry_test.go b/internal/unifiedresources/registry_test.goindex eb40666b59..e3b5088630 100644--- a/internal/unifiedresources/registry_test.go+++ b/internal/unifiedresources/registry_test.go@@ -4501,6 +4501,96 @@ func TestMergedHostCanonicalIDStableAcrossRestartsAndIngestOrders(t *testing.T)}}+// The end-to-end #1559 scenario: multiple standalone agents with dotted+// hostnames (cloud.rnd-lax1, cloud.gce-or1, cloud.dmi-lax1) must mint+// distinct canonical resources, persist full dotted hostnames in their+// identity pins instead of collapsing them all to "cloud", and boot-window+// records that only know the hostname must resolve to the right machine+// instead of the first pinned one.+func TestStandaloneDottedHostnameAgentsStayDistinct(t *testing.T) {+ store := NewMemoryStore()++ hosts := []struct {+ hostname string+ machineID string+ }{+ {"cloud.rnd-lax1", "machine-rnd"},+ {"cloud.gce-or1", "machine-gce"},+ {"cloud.dmi-lax1", "machine-dmi"},+ }++ agentResource := func(hostname, machineID string) Resource {+ return Resource{+ Type: ResourceTypeAgent,+ Name: hostname,+ Status: StatusOnline,+ Agent: &AgentData{AgentID: machineID, Hostname: hostname, MachineID: machineID},+ }+ }++ steady := NewRegistry(store)+ idByHostname := make(map[string]string, len(hosts))+ for _, host := range hosts {+ identity := ResourceIdentity{MachineID: host.machineID, Hostnames: []string{host.hostname}}+ id := steady.ingest(SourceAgent, host.machineID, agentResource(host.hostname, host.machineID), identity)+ if id == "" {+ t.Fatalf("agent ingest for %q returned no ID", host.hostname)+ }+ for hostname, existingID := range idByHostname {+ if existingID == id {+ t.Fatalf("hosts %q and %q collapsed to canonical ID %q", hostname, host.hostname, id)+ }+ }+ idByHostname[host.hostname] = id+ }+ if got := len(steady.List()); got != len(hosts) {+ t.Fatalf("expected %d distinct resources, got %d", len(hosts), got)+ }+ steady.PersistIdentityPins()++ pins, err := store.ListResourceIdentityPins()+ if err != nil {+ t.Fatalf("ListResourceIdentityPins: %v", err)+ }+ pinnedHostnames := make(map[string]struct{}, len(pins))+ for _, pin := range pins {+ pinnedHostnames[pin.Hostname] = struct{}{}+ }+ for _, host := range hosts {+ if _, ok := pinnedHostnames[host.hostname]; !ok {+ t.Fatalf("expected pinned primary hostname %q, got %v", host.hostname, pinnedHostnames)+ }+ }++ // Boot window: runtime records that only know the hostname (no machine+ // ID yet) arrive before the agents. Each must complete from its own pin+ // and land on its own canonical ID.+ boot := NewRegistry(store)+ for _, host := range hosts {+ record := Resource{+ Type: ResourceTypeAgent,+ Name: host.hostname,+ Status: StatusOnline,+ Docker: &DockerData{HostSourceID: "docker:" + host.hostname, Hostname: host.hostname},+ }+ identity := ResourceIdentity{Hostnames: []string{host.hostname}}+ id := boot.ingest(SourceDocker, "docker:"+host.hostname, record, identity)+ if want := idByHostname[host.hostname]; id != want {+ t.Fatalf("boot-window record for %q resolved %q, want its own canonical ID %q", host.hostname, id, want)+ }+ }+ for _, host := range hosts {+ identity := ResourceIdentity{MachineID: host.machineID, Hostnames: []string{host.hostname}}+ id := boot.ingest(SourceAgent, host.machineID, agentResource(host.hostname, host.machineID), identity)+ if want := idByHostname[host.hostname]; id != want {+ t.Fatalf("agent ingest for %q resolved %q, want %q", host.hostname, id, want)+ }+ }+ if got := len(boot.List()); got != len(hosts) {+ t.Fatalf("expected %d merged resources after boot-window ingest, got %d", len(hosts), got)+ }+}+// A synthesized placeholder (e.g. an offline PVE node for an instance that// has never completed a poll) carries a zero LastSeen. Ingest must preserve// that zero instead of fabricating a fresh sighting, and the per-source