adjusted lxc storage

This commit is contained in:
2025-03-09 22:17:10 -04:00
parent f8ea49f099
commit adafa796f1

View File

@ -1413,29 +1413,17 @@ class SystemHealthMonitor:
try:
if parts[0].startswith('appPool:') or '/mnt/pve/mediaf' in parts[0]:
continue
filesystem = {
'mountpoint': parts[5],
'total_space': parts[1], # Size
'used_space': parts[2], # Used
'available': parts[3], # Avail
'usage_percent': float(parts[4].rstrip('%')) # Use%
'total_space': self._parse_size(parts[1]), # Convert size to bytes
'used_space': self._parse_size(parts[2]), # Convert used to bytes
'available': self._parse_size(parts[3]), # Convert available to bytes
'usage_percent': float(parts[4].rstrip('%')) # Use percentage as is
}
container_info['filesystems'].append(filesystem)
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'])
avail_bytes = self._parse_size(filesystem['available'])
# Store both human readable and byte values
filesystem['total_bytes'] = self._parse_size(filesystem['total_space'])
filesystem['used_bytes'] = self._parse_size(filesystem['used_space'])
filesystem['avail_bytes'] = self._parse_size(filesystem['available'])
# Check thresholds
if filesystem['usage_percent'] >= self.CONFIG['THRESHOLDS']['LXC_CRITICAL']:
lxc_health['status'] = 'CRITICAL'
issue = f"LXC {vmid} critical storage usage: {filesystem['usage_percent']}% on {filesystem['mountpoint']}"
@ -1445,16 +1433,12 @@ class SystemHealthMonitor:
lxc_health['status'] = 'WARNING'
issue = f"LXC {vmid} high storage usage: {filesystem['usage_percent']}% on {filesystem['mountpoint']}"
lxc_health['issues'].append(issue)
logger.debug(f"Filesystem details: {filesystem}")
logger.debug(f"Usage percent: {filesystem['usage_percent']}%")
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 line: {str(e)}")
logger.debug(f"Full exception: {repr(e)}")
continue
lxc_health['containers'].append(container_info)
logger.debug(f"Added container info for VMID {vmid}")