From d42655769325266edd5085e5f077f9fd6e1329b2 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Sun, 9 Mar 2025 20:13:56 -0400 Subject: [PATCH] fs init better and better logs --- hwmonDaemon.py | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/hwmonDaemon.py b/hwmonDaemon.py index 58aea3a..c925f5b 100644 --- a/hwmonDaemon.py +++ b/hwmonDaemon.py @@ -1375,11 +1375,11 @@ class SystemHealthMonitor: if len(parts) >= 6: usage_percent = 0 filesystem = { - 'mountpoint': '', - 'total': '', - 'used': '', - 'available': '', - 'usage_percent': 0 + 'mountpoint': parts[5], # Last column is the mountpoint + 'total': parts[2], # Size column + 'used': parts[3], # Used column + 'available': parts[4], # Avail column + 'usage_percent': float(parts[4].rstrip('%')) # Use% column } if parts[0].startswith('appPool:'): @@ -1398,18 +1398,13 @@ class SystemHealthMonitor: used_size = self._convert_size_to_bytes(parts[2]) usage_percent = float(parts[4].rstrip('%')) - logger.debug(f"Storage metrics for {mountpoint}:") - logger.debug(f" Total: {parts[1]}") - logger.debug(f" Used: {parts[2]}") + logger.debug(f"Storage metrics parsed for LXC {vmid}:") + logger.debug(f" Filesystem: {parts[0]}") + logger.debug(f" Total: {filesystem['total']}") + logger.debug(f" Used: {filesystem['used']}") + logger.debug(f" Available: {filesystem['available']}") logger.debug(f" Usage: {usage_percent}%") - - filesystem.update({ - 'mountpoint': parts[5] if len(parts) >= 6 else '', - 'total': parts[1], - 'used': parts[2], - 'available': parts[3], - 'usage_percent': float(parts[4].rstrip('%')) - }) + logger.debug(f" Mountpoint: {filesystem['mountpoint']}") if usage_percent >= self.CONFIG['THRESHOLDS']['DISK_CRITICAL']: logger.debug(f"CRITICAL: Storage usage {usage_percent}% exceeds critical threshold")