From b43bf2bcb0c21627010a401758d8a99b2ee17ec0 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sun, 22 Jan 2023 09:13:06 +0100 Subject: [PATCH] Code should be refactor in order to make it more easy to update if a new container engine is added --- glances/plugins/glances_docker.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glances/plugins/glances_docker.py b/glances/plugins/glances_docker.py index 0758e78894..f2a281b919 100644 --- a/glances/plugins/glances_docker.py +++ b/glances/plugins/glances_docker.py @@ -443,12 +443,12 @@ def update_podman(self): # Standards stats if container_stats['Status'] in ('running', 'paused'): # CPU - # '3.21%' to 3.21 + # Convert: '3.21%' to 3.21 container_stats['cpu_percent'] = float(podman_stats[container_stats['IdShort']]['CPU'][:-1]) container_stats['cpu'] = {'total': container_stats['cpu_percent']} # MEMORY - # @TODO - # Should convert 'MemUsage': '352.3kB / 7.836GB' to bytes... + # Convert 'MemUsage': '352.3kB / 7.836GB' to bytes + # Yes it is ungly but the API do not expose the memory limit in bytes... container_stats['memory'] = { 'usage': string_value_to_float(podman_stats[container_stats['IdShort']]['MemUsage'].split(' / ')[0]), 'limit': string_value_to_float(podman_stats[container_stats['IdShort']]['MemUsage'].split(' / ')[1]),