debug to parse

This commit is contained in:
2025-03-09 21:12:31 -04:00
parent e9fc632086
commit a58d603fd0

View File

@ -1376,6 +1376,7 @@ class SystemHealthMonitor:
logger.debug(f"pct list output:\n{result.stdout}")
for line in result.stdout.split('\n')[1:]:
logger.debug(f"Raw LXC line: {line}")
if not line.strip():
continue
@ -1388,14 +1389,14 @@ class SystemHealthMonitor:
logger.debug(f"Processing container VMID: {vmid}, Status: {status}")
if status.lower() == 'running':
logger.debug(f"Checking disk usage for running container {vmid}")
logger.debug(f"Checking container {vmid} disk usage")
disk_info = subprocess.run(
['pct', 'df', vmid],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
logger.debug(f"pct df {vmid} output:\n{disk_info.stdout}")
logger.debug(f"Raw disk info output:\n{disk_info.stdout}")
container_info = {
'vmid': vmid,
@ -1409,9 +1410,9 @@ class SystemHealthMonitor:
logger.debug(f"Processing filesystem line: {fs_line}")
parts = fs_line.split()
logger.debug(f"Split parts: {parts}")
if len(parts) >= 6:
try:
# Skip appPool entries and mediafs mounts
if parts[0].startswith('appPool:') or '/mnt/pve/mediaf' in parts[0]:
continue
@ -1422,7 +1423,10 @@ class SystemHealthMonitor:
'available': parts[3], # Avail
'usage_percent': float(parts[4].rstrip('%')) # Use%
}
logger.debug(f"Usage percent before threshold check: {usage_percent}")
logger.debug(f"LXC_WARNING threshold: {self.CONFIG['THRESHOLDS']['LXC_WARNING']}")
logger.debug(f"LXC_CRITICAL threshold: {self.CONFIG['THRESHOLDS']['LXC_CRITICAL']}")
# Convert sizes to bytes for comparison
total_bytes = self._parse_size(filesystem['total_space'])
used_bytes = self._parse_size(filesystem['used_space'])
@ -1450,7 +1454,8 @@ class SystemHealthMonitor:
logger.debug(f"LXC_WARNING threshold: {self.CONFIG['THRESHOLDS']['LXC_WARNING']}%")
logger.debug(f"LXC_CRITICAL threshold: {self.CONFIG['THRESHOLDS']['LXC_CRITICAL']}%")
except Exception as e:
logger.debug(f"Error processing filesystem line for container {vmid}: {str(e)}")
logger.debug(f"Error processing line: {str(e)}")
logger.debug(f"Full exception: {repr(e)}")
continue
lxc_health['containers'].append(container_info)