diff --git a/custom-metrics/temperature.sh b/custom-metrics/temperature.sh index 1fce618..d8449f6 100755 --- a/custom-metrics/temperature.sh +++ b/custom-metrics/temperature.sh @@ -33,13 +33,19 @@ for i in {1..6}; do timestamp=$(GetTimestamp) if [[ "$OS_TYPE" == "macos" ]]; then - # Try osx-cpu-temp first + # Try osx-cpu-temp first (check both PATH and common install location) if command -v osx-cpu-temp &> /dev/null; then temp_output=$(osx-cpu-temp 2>/dev/null) if [[ $? -eq 0 && -n "$temp_output" ]]; then # Output format: "50.0°C" echo "$timestamp CPU $temp_output" >> "$LOGFILE" fi + elif [[ -x /usr/local/bin/osx-cpu-temp ]]; then + temp_output=$(/usr/local/bin/osx-cpu-temp 2>/dev/null) + if [[ $? -eq 0 && -n "$temp_output" ]]; then + # Output format: "50.0°C" + echo "$timestamp CPU $temp_output" >> "$LOGFILE" + fi # Fallback to powermetrics (requires sudo) elif [[ -x /usr/bin/powermetrics ]]; then # Run powermetrics for 1 second and extract temperature diff --git a/share/os-detection.sh b/share/os-detection.sh index cf919a3..7b5d7e3 100644 --- a/share/os-detection.sh +++ b/share/os-detection.sh @@ -119,7 +119,8 @@ IsThermalMonitoringSupported() { case "$os" in macos) # Check if osx-cpu-temp or powermetrics is available - command -v osx-cpu-temp &> /dev/null || [[ -x /usr/bin/powermetrics ]] + # Check both PATH and common install locations + command -v osx-cpu-temp &> /dev/null || [[ -x /usr/local/bin/osx-cpu-temp ]] || [[ -x /usr/bin/powermetrics ]] ;; linux) # Check if thermal zones exist