Update LXC storage utilization function

This commit is contained in:
2025-05-29 20:16:50 -04:00
parent 6907f71de1
commit 1371592b9e

View File

@ -1297,10 +1297,13 @@ class SystemHealthMonitor:
# Handle all other standard SMART attributes
for attr, thresholds in BASE_SMART_THRESHOLDS.items():
if attr in line and attr != 'Wear_Leveling_Count': # Skip wear leveling as it's handled above
if attr in line and attr != 'Wear_Leveling_Count':
parts = line.split()
if len(parts) >= 10:
raw_value = self._parse_smart_value(parts[9])
if attr == 'Erase_Fail_Count':
raw_value = int(parts[9]) if parts[9].isdigit() else 0
else:
raw_value = self._parse_smart_value(parts[9])
smart_health['attributes'][attr] = raw_value
if attr == 'Temperature_Celsius':
@ -1771,26 +1774,37 @@ class SystemHealthMonitor:
# Parse df output correctly
for fs_line in disk_info.stdout.split('\n')[1:]: # Skip header
if not fs_line.strip():
if not fs_line.strip() or 'MP' in fs_line:
continue
# Split the df line properly
fs_parts = fs_line.split()
logger.debug(f"Split parts: {fs_parts}")
if len(fs_parts) >= 6:
try:
filesystem = fs_parts[0]
# Skip excluded mounts by filesystem name
if filesystem.startswith('appPool:') or '/mnt/pve/mediafs' in filesystem:
logger.debug(f"Skipping excluded filesystem: {filesystem}")
continue
# Parse the values - pct df output format:
# Filesystem 1K-blocks Used Available Use% Mounted on
total_kb = int(fs_parts[1])
used_kb = int(fs_parts[2])
avail_kb = int(fs_parts[3])
usage_pct = int(fs_parts[4].rstrip('%'))
mountpoint = fs_parts[5]
# Skip excluded mounts
# Skip excluded mounts by mountpoint
if self._is_excluded_mount(mountpoint):
logger.debug(f"Skipping excluded mount: {mountpoint}")
continue
filesystem_info = {
'mountpoint': mountpoint,
'filesystem': filesystem,
'total_space': total_kb * 1024, # Convert to bytes
'used_space': used_kb * 1024,
'available': avail_kb * 1024,