From 662bb708222e81ee74484d62f0eae98bf94d0b0c Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Mon, 3 Mar 2025 17:05:26 -0500 Subject: [PATCH] SMART Debug --- hwmonDaemon.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/hwmonDaemon.py b/hwmonDaemon.py index 768ffb1..e118783 100644 --- a/hwmonDaemon.py +++ b/hwmonDaemon.py @@ -362,6 +362,8 @@ class SystemHealthMonitor: """ Enhanced SMART health check with detailed failure thresholds. """ + logger.debug(f"Checking SMART health for device: {device}") + smart_health = { 'status': 'HEALTHY', 'severity': 'NORMAL', @@ -418,6 +420,21 @@ class SystemHealthMonitor: # Parse SMART attributes with thresholds 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(): if attr in line: parts = line.split()