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
fix: Auto-clear stale LinkedHostAgentID references during node updates
rcourtman4a7306f6b8b0
diff --git a/internal/models/models.go b/internal/models/models.goindex ad05e92e25..926684db00 100644--- a/internal/models/models.go+++ b/internal/models/models.go@@ -1296,9 +1296,12 @@ func (s *State) UpdateNodesForInstance(instanceName string, nodes []Node) {}// Build hostname-to-hostAgentID map for linking new nodes to existing host agents+ // Also build a set of valid host agent IDs to validate existing linkshostAgentByHostname := make(map[string]string) // lowercase hostname -> hostAgentID+ validHostAgentIDs := make(map[string]bool) // set of existing host agent IDsfor _, host := range s.Hosts {if host.ID != "" {+ validHostAgentIDs[host.ID] = truehostAgentByHostname[strings.ToLower(host.Hostname)] = host.ID// Also index by short hostnameif idx := strings.Index(host.Hostname, "."); idx > 0 {@@ -1309,9 +1312,12 @@ func (s *State) UpdateNodesForInstance(instanceName string, nodes []Node) {// Add or update nodes from this instancefor _, node := range nodes {- // Preserve existing link if we had one+ // Preserve existing link if we had one, but only if the host agent still existsif existingLink, ok := existingNodeLinks[node.ID]; ok {- node.LinkedHostAgentID = existingLink+ if validHostAgentIDs[existingLink] {+ node.LinkedHostAgentID = existingLink+ }+ // If host agent no longer exists, leave LinkedHostAgentID empty (stale reference cleared)}// If no existing link, try to match by hostnameif node.LinkedHostAgentID == "" {