adjusted lxc storage
This commit is contained in:
@ -1416,26 +1416,14 @@ class SystemHealthMonitor:
|
|||||||
|
|
||||||
filesystem = {
|
filesystem = {
|
||||||
'mountpoint': parts[5],
|
'mountpoint': parts[5],
|
||||||
'total_space': parts[1], # Size
|
'total_space': self._parse_size(parts[1]), # Convert size to bytes
|
||||||
'used_space': parts[2], # Used
|
'used_space': self._parse_size(parts[2]), # Convert used to bytes
|
||||||
'available': parts[3], # Avail
|
'available': self._parse_size(parts[3]), # Convert available to bytes
|
||||||
'usage_percent': float(parts[4].rstrip('%')) # Use%
|
'usage_percent': float(parts[4].rstrip('%')) # Use percentage as is
|
||||||
}
|
}
|
||||||
container_info['filesystems'].append(filesystem)
|
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']:
|
if filesystem['usage_percent'] >= self.CONFIG['THRESHOLDS']['LXC_CRITICAL']:
|
||||||
lxc_health['status'] = 'CRITICAL'
|
lxc_health['status'] = 'CRITICAL'
|
||||||
issue = f"LXC {vmid} critical storage usage: {filesystem['usage_percent']}% on {filesystem['mountpoint']}"
|
issue = f"LXC {vmid} critical storage usage: {filesystem['usage_percent']}% on {filesystem['mountpoint']}"
|
||||||
@ -1447,14 +1435,10 @@ class SystemHealthMonitor:
|
|||||||
lxc_health['issues'].append(issue)
|
lxc_health['issues'].append(issue)
|
||||||
|
|
||||||
logger.debug(f"Filesystem details: {filesystem}")
|
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:
|
except Exception as e:
|
||||||
logger.debug(f"Error processing line: {str(e)}")
|
logger.debug(f"Error processing line: {str(e)}")
|
||||||
logger.debug(f"Full exception: {repr(e)}")
|
logger.debug(f"Full exception: {repr(e)}")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
lxc_health['containers'].append(container_info)
|
lxc_health['containers'].append(container_info)
|
||||||
logger.debug(f"Added container info for VMID {vmid}")
|
logger.debug(f"Added container info for VMID {vmid}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user