Better exclusions
This commit is contained in:
@ -50,7 +50,18 @@ class SystemHealthMonitor:
|
|||||||
'PING_TIMEOUT': 1,
|
'PING_TIMEOUT': 1,
|
||||||
'PING_COUNT': 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 = {
|
TICKET_TEMPLATES = {
|
||||||
'ACTION_TYPE': {
|
'ACTION_TYPE': {
|
||||||
@ -753,6 +764,18 @@ class SystemHealthMonitor:
|
|||||||
|
|
||||||
return list(disks)
|
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):
|
def _is_physical_disk(self, device_path):
|
||||||
"""
|
"""
|
||||||
Check if the device is a physical disk, excluding logical volumes and special devices.
|
Check if the device is a physical disk, excluding logical volumes and special devices.
|
||||||
@ -1358,8 +1381,7 @@ class SystemHealthMonitor:
|
|||||||
try:
|
try:
|
||||||
parts = fs_line.split()
|
parts = fs_line.split()
|
||||||
if len(parts) >= 6:
|
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']):
|
if parts[5] and not self._is_excluded_mount(parts[5]):
|
||||||
continue
|
|
||||||
|
|
||||||
# Convert size strings to comparable values
|
# Convert size strings to comparable values
|
||||||
total = parts[2]
|
total = parts[2]
|
||||||
|
|||||||
Reference in New Issue
Block a user