mirror of
https://github.com/nicolargo/glances.git
synced 2026-05-05 05:07:38 -04:00
Change client and browser call
This commit is contained in:
@@ -36,7 +36,6 @@ class GlancesClient:
|
||||
self.args = args
|
||||
self.config = config
|
||||
|
||||
print(args)
|
||||
self._quiet = args.quiet
|
||||
self.refresh_time = args.time
|
||||
|
||||
|
||||
@@ -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})")
|
||||
|
||||
Reference in New Issue
Block a user