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.

Fix SMART temperature collection on smartctl 7.4+ (related to #672)

rcourtman334b8c727f29
diff --git a/scripts/install-sensor-proxy.sh b/scripts/install-sensor-proxy.sh
index da361b320f..0b08e125d2 100755
--- a/scripts/install-sensor-proxy.sh
+++ b/scripts/install-sensor-proxy.sh
@@ -825,8 +825,9 @@ get_cached_smart() {
# Cache miss or stale - return empty array and trigger background refresh
echo "[]"
- # Trigger async refresh if not already running
- if ! pgrep -f "pulse-sensor-wrapper-refresh" >/dev/null 2>&1; then
+ # Trigger async refresh if not already running (use lock file)
+ local lock_file="$CACHE_DIR/smart-refresh.lock"
+ if ! [ -f "$lock_file" ]; then
(refresh_smart_cache &)
fi
@@ -835,11 +836,14 @@ get_cached_smart() {
# Function to refresh SMART cache in background
refresh_smart_cache() {
- # Mark this process for detection
- exec -a pulse-sensor-wrapper-refresh bash
-
+ local lock_file="$CACHE_DIR/smart-refresh.lock"
local cache_file="$CACHE_DIR/smart-temps.json"
local temp_file="${cache_file}.tmp.$$"
+
+ # Create lock file and ensure cleanup on exit
+ touch "$lock_file" 2>/dev/null || return 1
+ trap "rm -f '$lock_file' '$temp_file'" EXIT
+
local disks=()
# Find all physical disks (skip partitions, loop devices, etc.)
@@ -856,7 +860,7 @@ refresh_smart_cache() {
# timeout: prevent hanging on problematic drives
local output
- if output=$(timeout ${MAX_SMARTCTL_TIME}s smartctl -n standby,after -A --json=o "$dev" 2>/dev/null); then
+ if output=$(timeout ${MAX_SMARTCTL_TIME}s smartctl -n standby -A --json=o "$dev" 2>/dev/null); then
# Parse the JSON output
local temp=$(echo "$output" | jq -r '
.temperature.current //