From 30f1ae38c7eeb3a4c63e20ec118d7734395c8a54 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Mon, 3 Mar 2025 20:53:41 -0500 Subject: [PATCH] more detailed parition data --- hwmonDaemon.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hwmonDaemon.py b/hwmonDaemon.py index a914727..ef7da23 100644 --- a/hwmonDaemon.py +++ b/hwmonDaemon.py @@ -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, @@ -921,6 +926,10 @@ class SystemHealthMonitor: drive_report['partitions'].append(part_info) 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)