From 7c3487171a916ebbebec7e0015a1f98da9288174 Mon Sep 17 00:00:00 2001 From: Nikolai Petukhov Date: Fri, 6 Dec 2024 12:51:31 -0300 Subject: [PATCH] Disk usage info for multiple directories (#97) * add more info to disk usage info --- agent/worker/system_info.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/agent/worker/system_info.py b/agent/worker/system_info.py index fd0936e..efdc8a4 100644 --- a/agent/worker/system_info.py +++ b/agent/worker/system_info.py @@ -101,11 +101,25 @@ def cpu_freq_MHZ(): def get_disk_usage(): - disk_usage = psutil.disk_usage(constants.AGENT_ROOT_DIR()) # root dir mounted to host + root = psutil.disk_usage("/") + agent_data = psutil.disk_usage(constants.AGENT_ROOT_DIR()) # root dir mounted to host + apps_data = psutil.disk_usage(constants.SUPERVISELY_AGENT_FILES_CONTAINER()) res = { - "total": disk_usage.total, - "used": disk_usage.used, - "free": disk_usage.free, + "root": { + "total": root.total, + "used": root.used, + "free": root.free, + }, + "agent_data": { + "total": agent_data.total, + "used": agent_data.used, + "free": agent_data.free, + }, + "apps_data": { + "total": apps_data.total, + "used": apps_data.used, + "free": apps_data.free, + }, } return res