Update LXC storage utilization function
This commit is contained in:
@ -1297,10 +1297,13 @@ class SystemHealthMonitor:
|
|||||||
|
|
||||||
# Handle all other standard SMART attributes
|
# Handle all other standard SMART attributes
|
||||||
for attr, thresholds in BASE_SMART_THRESHOLDS.items():
|
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()
|
parts = line.split()
|
||||||
if len(parts) >= 10:
|
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
|
smart_health['attributes'][attr] = raw_value
|
||||||
|
|
||||||
if attr == 'Temperature_Celsius':
|
if attr == 'Temperature_Celsius':
|
||||||
@ -1771,26 +1774,37 @@ class SystemHealthMonitor:
|
|||||||
|
|
||||||
# Parse df output correctly
|
# Parse df output correctly
|
||||||
for fs_line in disk_info.stdout.split('\n')[1:]: # Skip header
|
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
|
continue
|
||||||
|
|
||||||
# Split the df line properly
|
# Split the df line properly
|
||||||
fs_parts = fs_line.split()
|
fs_parts = fs_line.split()
|
||||||
|
logger.debug(f"Split parts: {fs_parts}")
|
||||||
if len(fs_parts) >= 6:
|
if len(fs_parts) >= 6:
|
||||||
try:
|
try:
|
||||||
filesystem = fs_parts[0]
|
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])
|
total_kb = int(fs_parts[1])
|
||||||
used_kb = int(fs_parts[2])
|
used_kb = int(fs_parts[2])
|
||||||
avail_kb = int(fs_parts[3])
|
avail_kb = int(fs_parts[3])
|
||||||
usage_pct = int(fs_parts[4].rstrip('%'))
|
usage_pct = int(fs_parts[4].rstrip('%'))
|
||||||
mountpoint = fs_parts[5]
|
mountpoint = fs_parts[5]
|
||||||
|
|
||||||
# Skip excluded mounts
|
# Skip excluded mounts by mountpoint
|
||||||
if self._is_excluded_mount(mountpoint):
|
if self._is_excluded_mount(mountpoint):
|
||||||
|
logger.debug(f"Skipping excluded mount: {mountpoint}")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
filesystem_info = {
|
filesystem_info = {
|
||||||
'mountpoint': mountpoint,
|
'mountpoint': mountpoint,
|
||||||
|
'filesystem': filesystem,
|
||||||
'total_space': total_kb * 1024, # Convert to bytes
|
'total_space': total_kb * 1024, # Convert to bytes
|
||||||
'used_space': used_kb * 1024,
|
'used_space': used_kb * 1024,
|
||||||
'available': avail_kb * 1024,
|
'available': avail_kb * 1024,
|
||||||
|
|||||||
Reference in New Issue
Block a user