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
Improve temperature proxy detection
rcourtman1abff55febab
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.goindex fe7145cdd7..dc641ac15e 100644--- a/internal/monitoring/monitor.go+++ b/internal/monitoring/monitor.go@@ -30,6 +30,7 @@ import ("github.com/rcourtman/pulse-go-rewrite/internal/models""github.com/rcourtman/pulse-go-rewrite/internal/notifications""github.com/rcourtman/pulse-go-rewrite/internal/system"+ "github.com/rcourtman/pulse-go-rewrite/internal/tempproxy""github.com/rcourtman/pulse-go-rewrite/internal/types""github.com/rcourtman/pulse-go-rewrite/internal/websocket"agentsdocker "github.com/rcourtman/pulse-go-rewrite/pkg/agents/docker"@@ -3459,17 +3460,24 @@ func (m *Monitor) GetConnectionStatuses() map[string]bool {// HasSocketTemperatureProxy reports whether the local unix socket proxy is available.func (m *Monitor) HasSocketTemperatureProxy() bool {+ // Always check the real socket path first so we reflect the actual runtime state+ // even if the temperature collector hasn't latched onto the proxy yet.+ if tempproxy.NewClient().IsAvailable() {+ return true+ }+if m == nil {return false}m.mu.RLock()- defer m.mu.RUnlock()+ collector := m.tempCollector+ m.mu.RUnlock()- if m.tempCollector == nil {+ if collector == nil {return false}- return m.tempCollector.SocketProxyDetected()+ return collector.SocketProxyDetected()}// SocketProxyHostDiagnostics exposes per-host proxy cooldown state for diagnostics.diff --git a/internal/monitoring/monitor_proxy_test.go b/internal/monitoring/monitor_proxy_test.gonew file mode 100644index 0000000000..d9f4aba73b--- /dev/null+++ b/internal/monitoring/monitor_proxy_test.go@@ -0,0 +1,23 @@+package monitoring++import (+ "os"+ "path/filepath"+ "testing"+)++func TestMonitorHasSocketTemperatureProxyDetectsEnvSocket(t *testing.T) {+ dir := t.TempDir()+ socketPath := filepath.Join(dir, "pulse-sensor-proxy.sock")++ if err := os.WriteFile(socketPath, []byte("socket-placeholder"), 0o600); err != nil {+ t.Fatalf("failed to create fake socket: %v", err)+ }++ t.Setenv("PULSE_SENSOR_PROXY_SOCKET", socketPath)++ monitor := &Monitor{}+ if !monitor.HasSocketTemperatureProxy() {+ t.Fatalf("expected monitor to detect proxy socket at %s", socketPath)+ }+}diff --git a/scripts/install-sensor-proxy.sh b/scripts/install-sensor-proxy.shindex 2cfde2ea37..55aa7a22f0 100755--- a/scripts/install-sensor-proxy.sh+++ b/scripts/install-sensor-proxy.sh@@ -1520,17 +1520,40 @@ write_control_plane_token() {ensure_control_plane_config() {local pulse_url="$1"local refresh="$2"+ local config_file="/etc/pulse-sensor-proxy/config.yaml"+if [[ -z "$pulse_url" ]]; thenreturnfiif [[ -z "$refresh" ]]; thenrefresh=60fi- if grep -q "^pulse_control_plane:" /etc/pulse-sensor-proxy/config.yaml 2>/dev/null; then++ if grep -q "^pulse_control_plane:" "$config_file" 2>/dev/null; then+ # Re-write the existing control-plane block with the latest URL/token path.+ local tmp+ tmp=$(mktemp)+ awk -v url="$pulse_url" -v refresh="$refresh" '+ BEGIN { in_block = 0 }+ /^pulse_control_plane:/ {+ print "pulse_control_plane:"+ print " url: " url+ print " token_file: /etc/pulse-sensor-proxy/.pulse-control-token"+ print " refresh_interval: " refresh+ print ""+ in_block = 1+ next+ }+ # Exit the replacement block when we hit a non-indented line+ in_block && /^[^[:space:]]/ { in_block = 0 }+ in_block { next }+ { print }+ ' "$config_file" > "$tmp"+ mv "$tmp" "$config_file"returnfi- cat >> /etc/pulse-sensor-proxy/config.yaml << EOF+ cat >> "$config_file" << EOF# Pulse control plane configuration (auto-generated)pulse_control_plane: