Fix temperature monitoring on standalone Proxmox nodes (addresses #571)

The standalone node detection in discoverClusterNodes was only checking
stderr for "not part of a cluster" messages, but some Proxmox versions
write these messages to stdout instead. This caused the fallback to
discoverLocalHostAddresses to never trigger, leaving temperature
monitoring broken on standalone nodes.

Changes:
- Check both stdout and stderr for standalone node indicators
- Document exit code 255 in addition to code 2
- Improve error logging to show both stdout and stderr

This ensures standalone nodes correctly fall back to local address
discovery regardless of where pvecm writes its error messages.
This commit is contained in:
rcourtman 2025-11-12 11:51:41 +00:00
parent aa2ac4bb2c
commit b7cfafe2cf

View file

@ -571,23 +571,27 @@ func discoverClusterNodes() ([]string, error) {
cmd.Stderr = &stderr
err := cmd.Run()
// pvecm status exits with code 2 on standalone nodes (not in a cluster)
// pvecm status exits with code 2 or 255 on standalone nodes (not in a cluster)
// Also handle LXC containers where pvecm can't access corosync IPC
// Treat these as valid cases and discover local host addresses
if err != nil {
stderrStr := stderr.String()
stdoutStr := out.String()
combinedOutput := stderrStr + stdoutStr
// Check if this is a standalone node or LXC container
// - "does not exist" or "not part of a cluster": standalone node
// - "ipcc_send_rec": running in LXC container without corosync access
if strings.Contains(stderrStr, "does not exist") ||
strings.Contains(stderrStr, "not part of a cluster") ||
strings.Contains(stderrStr, "ipcc_send_rec") {
// Note: Some Proxmox versions write these messages to stdout, others to stderr
if strings.Contains(combinedOutput, "does not exist") ||
strings.Contains(combinedOutput, "not part of a cluster") ||
strings.Contains(combinedOutput, "ipcc_send_rec") {
log.Info().Msg("Standalone Proxmox node or LXC container detected - discovering local host addresses")
return discoverLocalHostAddresses()
}
// For other errors, fail
log.Warn().Str("stderr", stderrStr).Msg("pvecm status failed")
return nil, fmt.Errorf("failed to get cluster status: %w (stderr: %s)", err, stderrStr)
log.Warn().Str("stderr", stderrStr).Str("stdout", stdoutStr).Msg("pvecm status failed")
return nil, fmt.Errorf("failed to get cluster status: %w (stderr: %s, stdout: %s)", err, stderrStr, stdoutStr)
}
// Parse output to extract IP addresses