fix: prevent syslog spam on standalone Proxmox nodes

- Only check cluster status during initial configuration, not during polling
- Cache cluster membership in config to avoid repeated API calls
- Skip cluster/resources endpoint entirely for standalone nodes
- Change cluster detection failure from WARN to DEBUG (expected for standalone)

This addresses #322 where standalone PVE nodes were causing certificate
lookup errors in syslog every minute during polling.
This commit is contained in:
Pulse Monitor
2025-08-18 09:43:04 +00:00
parent 9f0b7e8cba
commit 496f0ee3a5
2 changed files with 22 additions and 5 deletions
+3 -1
View File
@@ -149,9 +149,11 @@ func detectPVECluster(clientConfig proxmox.ClientConfig, nodeName string) (isClu
defer cancel()
// Get full cluster status to find the actual cluster name
// Note: This can cause certificate lookup errors on standalone nodes, but it's only done once during configuration
clusterStatus, err := tempClient.GetClusterStatus(ctx)
if err != nil {
log.Warn().Err(err).Msg("Failed to get cluster status")
// This is expected for standalone nodes - they will return an error when accessing cluster endpoints
log.Debug().Err(err).Msg("Could not get cluster status - likely a standalone node")
return false, "", nil
}
+19 -4
View File
@@ -856,16 +856,31 @@ func (m *Monitor) pollPVEInstance(ctx context.Context, instanceName string, clie
// pollVMsAndContainersEfficient uses the cluster/resources endpoint to get all VMs and containers in one call
func (m *Monitor) pollVMsAndContainersEfficient(ctx context.Context, instanceName string, client PVEClientInterface) bool {
// First check if this is actually a cluster member
// Non-clustered nodes will trigger certificate errors when trying to use cluster/resources
// Get instance config to check if this is configured as a cluster
var instanceCfg *config.PVEInstance
for _, cfg := range m.config.PVEInstances {
if cfg.Name == instanceName {
instanceCfg = &cfg
break
}
}
// If not configured as a cluster, don't even try cluster endpoints
if instanceCfg == nil || !instanceCfg.IsCluster {
log.Debug().Str("instance", instanceName).Bool("isCluster", instanceCfg != nil && instanceCfg.IsCluster).Msg("Instance not configured as cluster, using traditional polling")
return false
}
// For cluster configurations, verify it's still a cluster
// This check is cached in the configuration, so we avoid repeated API calls
isCluster, err := client.IsClusterMember(ctx)
if err != nil {
log.Debug().Err(err).Str("instance", instanceName).Msg("Could not determine cluster membership, falling back to traditional polling")
log.Debug().Err(err).Str("instance", instanceName).Msg("Could not verify cluster membership, falling back to traditional polling")
return false
}
if !isCluster {
log.Debug().Str("instance", instanceName).Msg("Node is not in a cluster, using traditional polling")
log.Debug().Str("instance", instanceName).Msg("Configured as cluster but node reports not in a cluster, using traditional polling")
return false
}