SMART Debug

This commit is contained in:
2025-03-03 17:05:26 -05:00
parent 8660b3b6e4
commit 662bb70822

View File

@ -362,6 +362,8 @@ class SystemHealthMonitor:
""" """
Enhanced SMART health check with detailed failure thresholds. Enhanced SMART health check with detailed failure thresholds.
""" """
logger.debug(f"Checking SMART health for device: {device}")
smart_health = { smart_health = {
'status': 'HEALTHY', 'status': 'HEALTHY',
'severity': 'NORMAL', 'severity': 'NORMAL',
@ -418,6 +420,21 @@ class SystemHealthMonitor:
# Parse SMART attributes with thresholds # Parse SMART attributes with thresholds
for line in output.split('\n'): for line in output.split('\n'):
# Inside the try block where SMART attributes are parsed:
if 'Reported_Uncorrect' in line:
parts = line.split()
raw_value = int(parts[9])
logger.debug(f"Found Reported_Uncorrect value: {raw_value}")
smart_health['attributes']['Reported_Uncorrect'] = raw_value
if raw_value >= SMART_THRESHOLDS['Reported_Uncorrect']['critical']:
smart_health['status'] = 'UNHEALTHY'
smart_health['severity'] = 'CRITICAL'
smart_health['issues'].append(f"Critical uncorrectable errors: {raw_value}")
elif raw_value >= SMART_THRESHOLDS['Reported_Uncorrect']['warning']:
if smart_health['severity'] != 'CRITICAL':
smart_health['severity'] = 'WARNING'
smart_health['issues'].append(f"Warning: uncorrectable errors detected: {raw_value}")
for attr, thresholds in SMART_THRESHOLDS.items(): for attr, thresholds in SMART_THRESHOLDS.items():
if attr in line: if attr in line:
parts = line.split() parts = line.split()