diff options
Diffstat (limited to 'glances/client_browser.py')
-rw-r--r-- | glances/client_browser.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/glances/client_browser.py b/glances/client_browser.py index 8e0ec721..12a52680 100644 --- a/glances/client_browser.py +++ b/glances/client_browser.py @@ -95,12 +95,16 @@ class GlancesClientBrowser: # Mandatory stats try: # CPU% - cpu_percent = 100 - orjson.loads(s.getPlugin('cpu'))['idle'] - server['cpu_percent'] = f'{cpu_percent:.1f}' + # logger.info(f"CPU stats {s.getPlugin('cpu')}") + # logger.info(f"CPU views {s.getPluginView('cpu')}") + server['cpu_percent'] = orjson.loads(s.getPlugin('cpu'))['total'] + server['cpu_percent_decoration'] = orjson.loads(s.getPluginView('cpu'))['total']['decoration'] # MEM% server['mem_percent'] = orjson.loads(s.getPlugin('mem'))['percent'] + server['mem_percent_decoration'] = orjson.loads(s.getPluginView('mem'))['percent']['decoration'] # OS (Human Readable name) server['hr_name'] = orjson.loads(s.getPlugin('system'))['hr_name'] + server['hr_name_decoration'] = 'DEFAULT' except (OSError, Fault, KeyError) as e: logger.debug(f"Error while grabbing stats form server ({e})") server['status'] = 'OFFLINE' @@ -120,8 +124,8 @@ class GlancesClientBrowser: # Optional stats (load is not available on Windows OS) try: # LOAD - load_min5 = orjson.loads(s.getPlugin('load'))['min5'] - server['load_min5'] = f'{load_min5:.2f}' + server['load_min5'] = round(orjson.loads(s.getPlugin('load'))['min5'], 1) + server['load_min5_decoration'] = orjson.loads(s.getPluginView('load'))['min5']['decoration'] except Exception as e: logger.warning(f"Error while grabbing stats form server ({e})") |