more detailed parition data

This commit is contained in:
2025-03-03 20:53:41 -05:00
parent 6e3d537119
commit 30f1ae38c7

View File

@ -901,14 +901,19 @@ class SystemHealthMonitor:
drive_report = {
'device': disk,
'partitions': [],
'smart_status': 'UNKNOWN'
'smart_status': 'UNKNOWN',
'usage_percent': 0
}
# Add partition information if available
if disk in device_partitions:
total_used = 0
total_space = 0
for partition in device_partitions[disk]:
try:
usage = psutil.disk_usage(partition.mountpoint)
total_used += usage.used
total_space += usage.total
part_info = {
'device': partition.device,
'mountpoint': partition.mountpoint,
@ -922,6 +927,10 @@ class SystemHealthMonitor:
except Exception as e:
logger.debug(f"Error getting partition usage for {partition.device}: {e}")
# Calculate overall drive usage percentage
if total_space > 0:
drive_report['usage_percent'] = (total_used / total_space) * 100
# Check SMART health
smart_health = self._check_smart_health(disk)
drive_report.update({