fixed smart_health undefined
This commit is contained in:
@ -396,8 +396,18 @@ class SystemHealthMonitor:
|
|||||||
|
|
||||||
if "Drive" in issue:
|
if "Drive" in issue:
|
||||||
device = re.search(r'/dev/[a-zA-Z0-9]+', issue).group(0)
|
device = re.search(r'/dev/[a-zA-Z0-9]+', issue).group(0)
|
||||||
drive_details = self._get_drive_details(device)
|
|
||||||
drive_info = next((d for d in health_report['drives_health']['drives'] if d['device'] == device), None)
|
drive_info = next((d for d in health_report['drives_health']['drives'] if d['device'] == device), None)
|
||||||
|
drive_details = self._get_drive_details(device)
|
||||||
|
|
||||||
|
smart_data = {
|
||||||
|
'attributes': drive_info.get('smart_attributes', {}),
|
||||||
|
'performance_metrics': drive_info.get('performance_metrics', {}),
|
||||||
|
'last_test_date': drive_info.get('last_test_date', 'N/A')
|
||||||
|
}
|
||||||
|
|
||||||
|
power_on_hours = smart_data['attributes'].get('Power_On_Hours', 'N/A')
|
||||||
|
last_test_date = smart_data.get('last_test_date', 'N/A')
|
||||||
|
age = f"{int(power_on_hours/24/365) if isinstance(power_on_hours, (int, float)) else 'N/A'} years" if power_on_hours != 'N/A' else 'N/A'
|
||||||
|
|
||||||
description += """
|
description += """
|
||||||
┏━ DRIVE SPECIFICATIONS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
┏━ DRIVE SPECIFICATIONS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||||
@ -433,9 +443,6 @@ class SystemHealthMonitor:
|
|||||||
┃ IOPS │ {perf_metrics['iops']}{' ' * 52}┃
|
┃ IOPS │ {perf_metrics['iops']}{' ' * 52}┃
|
||||||
┗{'━' * 71}┛
|
┗{'━' * 71}┛
|
||||||
"""
|
"""
|
||||||
power_on_hours = smart_health['attributes'].get('Power_On_Hours', 'N/A')
|
|
||||||
last_test_date = smart_health.get('last_test_date', 'N/A')
|
|
||||||
age = f"{int(power_on_hours/24/365) if isinstance(power_on_hours, (int, float)) else 'N/A'} years" if power_on_hours != 'N/A' else 'N/A'
|
|
||||||
|
|
||||||
description += """
|
description += """
|
||||||
┏━ DRIVE TIMELINE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
┏━ DRIVE TIMELINE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||||
|
|||||||
Reference in New Issue
Block a user