Better exclusions

This commit is contained in:
2025-03-09 17:43:49 -04:00
parent fecd9230a5
commit ed5b0cab52

View File

@ -50,7 +50,18 @@ class SystemHealthMonitor:
'PING_TIMEOUT': 1,
'PING_COUNT': 1
},
'EXCLUDED_MOUNTS': ['/media', '/mnt/pve/mediafs']
'EXCLUDED_MOUNTS': [
'/media',
'/mnt/pve/mediafs',
'/opt/metube_downloads'
],
'EXCLUDED_PATTERNS': [
r'/media.*',
r'/mnt/pve/mediafs.*',
r'.*/media$',
r'.*mediafs.*',
r'.*/downloads.*'
]
}
TICKET_TEMPLATES = {
'ACTION_TYPE': {
@ -753,6 +764,18 @@ class SystemHealthMonitor:
return list(disks)
def _is_excluded_mount(self, mountpoint: str) -> bool:
"""Check if a mountpoint should be excluded from monitoring."""
# Check exact matches
if mountpoint in self.CONFIG['EXCLUDED_MOUNTS']:
return True
# Check patterns
for pattern in self.CONFIG['EXCLUDED_PATTERNS']:
if re.match(pattern, mountpoint):
return True
return False
def _is_physical_disk(self, device_path):
"""
Check if the device is a physical disk, excluding logical volumes and special devices.
@ -1358,8 +1381,7 @@ class SystemHealthMonitor:
try:
parts = fs_line.split()
if len(parts) >= 6:
if parts[5] in self.CONFIG['EXCLUDED_MOUNTS'] or any(excluded in parts[5] for excluded in self.CONFIG['EXCLUDED_MOUNTS']):
continue
if parts[5] and not self._is_excluded_mount(parts[5]):
# Convert size strings to comparable values
total = parts[2]