We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 79d68e4 commit 8c64d7eCopy full SHA for 8c64d7e
1 file changed
app/repositories/hosts_metrics.py
@@ -18,3 +18,17 @@ def list_enabled_hosts(self):
18
return cursor.fetchall()
19
finally:
20
conn.close()
21
+
22
+ def get_metrics(self, docker_client):
23
+ info = docker_client.info()
24
+ total_mem = info.get('MemTotal', 0) or 0
25
+ total_mem_gb = round(total_mem / (1024**3), 2) if total_mem else 0
26
+ return {
27
+ 'os': info.get('OperatingSystem', 'Unknown'),
28
+ 'docker_version': info.get('ServerVersion', 'Unknown'),
29
+ 'cpus': info.get('NCPU', 0),
30
+ 'total_memory_gb': total_mem_gb,
31
+ 'containers_running': info.get('ContainersRunning', 0),
32
+ 'containers_stopped': info.get('ContainersStopped', 0),
33
+ 'containers_paused': info.get('ContainersPaused', 0),
34
+ }
0 commit comments