Fix temperature collection regression for cluster nodes. Related to #727

This commit is contained in:
courtmanr@gmail.com 2025-11-23 12:13:57 +00:00
parent 0c7b61c989
commit 4bf9c42dbc

View file

@ -6168,16 +6168,8 @@ func (m *Monitor) pollPVEInstance(ctx context.Context, instanceName string, clie
shouldCollect := true shouldCollect := true
if modelNode.IsClusterMember && instanceCfg.IsCluster { if modelNode.IsClusterMember && instanceCfg.IsCluster {
// For cluster members, wait until we have validated endpoints // Try to find specific endpoint configuration for this node
// This prevents collecting wrong temperature data during initialization if len(instanceCfg.ClusterEndpoints) > 0 {
if len(instanceCfg.ClusterEndpoints) == 0 {
tempCancel()
log.Debug().
Str("node", node.Node).
Str("instance", instanceCfg.Name).
Msg("Skipping temperature collection - cluster endpoints not yet validated")
shouldCollect = false
} else {
hasFingerprint := instanceCfg.Fingerprint != "" hasFingerprint := instanceCfg.Fingerprint != ""
for _, ep := range instanceCfg.ClusterEndpoints { for _, ep := range instanceCfg.ClusterEndpoints {
if strings.EqualFold(ep.NodeName, node.Node) { if strings.EqualFold(ep.NodeName, node.Node) {
@ -6188,18 +6180,15 @@ func (m *Monitor) pollPVEInstance(ctx context.Context, instanceName string, clie
break break
} }
} }
}
// If this node is a cluster member but we didn't find its specific endpoint, // If no specific endpoint found, fall back to node name
// skip temperature collection to avoid using wrong endpoint if !foundNodeEndpoint {
if !foundNodeEndpoint { sshHost = node.Node
tempCancel() log.Debug().
log.Debug(). Str("node", node.Node).
Str("node", node.Node). Str("instance", instanceCfg.Name).
Str("instance", instanceCfg.Name). Msg("Node endpoint not found in cluster metadata - falling back to node name for temperature collection")
Int("endpointCount", len(instanceCfg.ClusterEndpoints)).
Msg("Skipping temperature collection - node endpoint not found in cluster metadata")
shouldCollect = false
}
} }
} }