Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Pre-populate node display name cache before guest polling

rcourtmancffb91f9ea88
diff --git a/internal/alerts/alerts.go b/internal/alerts/alerts.go
index 4aec26cf55..7ca5db7f54 100644
--- a/internal/alerts/alerts.go
+++ b/internal/alerts/alerts.go
@@ -2621,7 +2621,7 @@ func (m *Manager) CheckGuest(guest interface{}, instanceName string) {
// CheckNode checks a node against thresholds
func (m *Manager) CheckNode(node models.Node) {
// Cache display name so all alerts (including guest alerts on this node) can resolve it.
- m.updateNodeDisplayName(node.Name, node.DisplayName)
+ m.UpdateNodeDisplayName(node.Name, node.DisplayName)
m.mu.RLock()
if !m.config.Enabled {
@@ -2761,9 +2761,9 @@ func (m *Manager) hasHostAgentForNode(nodeName string) bool {
return exists
}
-// updateNodeDisplayName caches the display name for a node/host so alerts
+// UpdateNodeDisplayName caches the display name for a node/host so alerts
// can resolve it without needing the full model object.
-func (m *Manager) updateNodeDisplayName(name, displayName string) {
+func (m *Manager) UpdateNodeDisplayName(name, displayName string) {
name = strings.TrimSpace(name)
if name == "" {
return
@@ -2879,7 +2879,7 @@ func (m *Manager) CheckHost(host models.Host) {
}
// Cache display name so host alerts show the user-configured name.
- m.updateNodeDisplayName(host.Hostname, host.DisplayName)
+ m.UpdateNodeDisplayName(host.Hostname, host.DisplayName)
// Fresh telemetry marks the host as online and clears offline tracking.
m.HandleHostOnline(host)
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go
index 76d9a186e8..ec5ff36291 100644
--- a/internal/monitoring/monitor.go
+++ b/internal/monitoring/monitor.go
@@ -6050,6 +6050,16 @@ func (m *Monitor) pollPVEInstance(ctx context.Context, instanceName string, clie
close(storageFallbackDone)
}
+ // Pre-populate node display name cache so guest alerts created below
+ // can resolve friendly names. CheckNode() also does this, but it runs
+ // after guest polling — without this, the first alert notification for
+ // a guest would show the raw Proxmox node name.
+ for i := range modelNodes {
+ if modelNodes[i].DisplayName != "" {
+ m.alertManager.UpdateNodeDisplayName(modelNodes[i].Name, modelNodes[i].DisplayName)
+ }
+ }
+
// Poll VMs and containers FIRST - this is the most critical data.
// This happens immediately after starting the storage fallback goroutine,
// so VM/container polling runs in parallel with (and is not blocked by) storage operations.