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