correctly parse and evaluate NVMe temperatures
This commit is contained in:
@ -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:
|
||||
|
||||
Reference in New Issue
Block a user