From 05e86f9204bf425ebf5b091b8049ed86bb4f39ec Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Mon, 3 Mar 2025 20:26:44 -0500 Subject: [PATCH] correctly parse and evaluate NVMe temperatures --- hwmonDaemon.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hwmonDaemon.py b/hwmonDaemon.py index bbe1175..488534e 100644 --- a/hwmonDaemon.py +++ b/hwmonDaemon.py @@ -842,10 +842,18 @@ class SystemHealthMonitor: ) for line in nvme_result.stdout.split('\n'): if 'temperature' in line.lower(): + # Extract only the numeric temperature value temp_str = line.split(':')[1].strip() - # Extract numeric temperature value - temp_value = int(''.join(filter(str.isdigit, temp_str))) + temp_value = int(''.join(c for c in temp_str if c.isdigit())[0:2]) smart_health['temp'] = temp_value + + # Update temperature thresholds + if temp_value >= SMART_THRESHOLDS['Temperature_Celsius']['critical']: + smart_health['severity'] = 'CRITICAL' + smart_health['issues'].append(f"Critical temperature: {temp_value}°C") + elif temp_value >= SMART_THRESHOLDS['Temperature_Celsius']['warning']: + smart_health['severity'] = 'WARNING' + smart_health['issues'].append(f"High temperature: {temp_value}°C") break except Exception as e: