From b7293143ff8b04876ab50ef90e0217761feac9cf Mon Sep 17 00:00:00 2001 From: xiaofan Date: Tue, 26 Dec 2023 10:47:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20busybox=20free=20-m=20?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=AD=A3=E5=B8=B8=E8=8E=B7=E5=8F=96=E5=86=85?= =?UTF-8?q?=E5=AD=98=E5=A4=A7=E5=B0=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiaofan --- spug_api/apps/host/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spug_api/apps/host/utils.py b/spug_api/apps/host/utils.py index 2dec266..a379f4d 100644 --- a/spug_api/apps/host/utils.py +++ b/spug_api/apps/host/utils.py @@ -240,9 +240,9 @@ def fetch_host_extend(ssh): else: response['memory'] = round(int(size) / 1024, 0) if 'memory' not in response: - code, out = ssh.exec_command_raw("free -m | awk 'NR==2{print $2}'") + code, out = ssh.exec_command_raw("cat /proc/meminfo | grep 'MemTotal' | awk '{print $2}'") if code == 0: - response['memory'] = math.ceil(int(out) / 1024) + response['memory'] = math.ceil(int(out) / 1024 / 1024) response['public_ip_address'] = list(public_ip_address) response['private_ip_address'] = list(private_ip_address)