update parsing
This commit is contained in:
@ -783,11 +783,9 @@ class SystemHealthMonitor:
|
||||
if not size_str or not isinstance(size_str, str):
|
||||
return 0.0
|
||||
|
||||
# Remove any whitespace and convert to uppercase for consistent handling
|
||||
size_str = size_str.strip().upper()
|
||||
|
||||
# Handle values with decimal points (like 192.2M)
|
||||
match = re.match(r'^([\d.]+)\s*([KMGT])?B?$', size_str)
|
||||
match = re.match(r'^([\d.]+)\s*([KMGT])?B?$', size_str) # Corrected regex
|
||||
if match:
|
||||
value = float(match.group(1))
|
||||
unit = match.group(2) if match.group(2) else 'B'
|
||||
@ -1424,9 +1422,9 @@ class SystemHealthMonitor:
|
||||
avail_bytes = self._parse_size(filesystem['available'])
|
||||
|
||||
# Store both human readable and byte values
|
||||
filesystem['total_bytes'] = total_bytes
|
||||
filesystem['used_bytes'] = used_bytes
|
||||
filesystem['avail_bytes'] = avail_bytes
|
||||
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'])
|
||||
|
||||
if filesystem['usage_percent'] >= self.CONFIG['THRESHOLDS']['LXC_CRITICAL']:
|
||||
lxc_health['status'] = 'CRITICAL'
|
||||
|
||||
Reference in New Issue
Block a user