From bae393196ce747792c06ba33d46d6ceaca546984 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 18 Jan 2019 19:14:02 +0800 Subject: [PATCH] . --- chapter2/mysite/myapp/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chapter2/mysite/myapp/utils.py b/chapter2/mysite/myapp/utils.py index 5e43c16..01a6e7a 100644 --- a/chapter2/mysite/myapp/utils.py +++ b/chapter2/mysite/myapp/utils.py @@ -37,6 +37,14 @@ def get_platform_info(): info["mem_free"] = m.group(2) info["mem_used"] = m.group(3) + #硬盘使用 + out = get_execute_out('df -h') + m = re.match(r'\/dev\/vda1\s+?(.+?)G\s+(.+?)G\s+(.+?)G', out) + if m: + info['disk_total'] = m.group(1) + info['disk_used'] = m.group(2) + info['disk_freed'] = m.group(3) + return info return {'up_time': '20:52', 'tasks': '127', 'cpu_us': '1.6', 'cpu_sy': '1.6', 'cpu_id': '96.9', 'mem_total': '12134268', 'mem_free': '5648868', 'mem_used': '4537556'}