Change client and browser call

This commit is contained in:
nicolargo
2024-05-25 10:02:35 +02:00
parent c61d10bec7
commit 6d2ecf5cf0
2 changed files with 4 additions and 5 deletions

View File

@@ -36,7 +36,6 @@ class GlancesClient:
self.args = args
self.config = config
print(args)
self._quiet = args.quiet
self.refresh_time = args.time

View File

@@ -95,12 +95,12 @@ class GlancesClientBrowser:
# Mandatory stats
try:
# CPU%
cpu_percent = 100 - orjson.loads(s.getCpu())['idle']
cpu_percent = 100 - orjson.loads(s.getPlugin('cpu'))['idle']
server['cpu_percent'] = f'{cpu_percent:.1f}'
# MEM%
server['mem_percent'] = orjson.loads(s.getMem())['percent']
server['mem_percent'] = orjson.loads(s.getPlugin('mem'))['percent']
# OS (Human Readable name)
server['hr_name'] = orjson.loads(s.getSystem())['hr_name']
server['hr_name'] = orjson.loads(s.getPlugin('system'))['hr_name']
except (OSError, Fault, KeyError) as e:
logger.debug(f"Error while grabbing stats form server ({e})")
server['status'] = 'OFFLINE'
@@ -120,7 +120,7 @@ class GlancesClientBrowser:
# Optional stats (load is not available on Windows OS)
try:
# LOAD
load_min5 = orjson.loads(s.getLoad())['min5']
load_min5 = orjson.loads(s.getPlugin('load'))['min5']
server['load_min5'] = f'{load_min5:.2f}'
except Exception as e:
logger.warning(f"Error while grabbing stats form server ({e})")