This commit is contained in:
guange 2019-01-18 19:14:02 +08:00
parent d32f766095
commit bae393196c
1 changed files with 8 additions and 0 deletions

View File

@ -37,6 +37,14 @@ def get_platform_info():
info["mem_free"] = m.group(2) info["mem_free"] = m.group(2)
info["mem_used"] = m.group(3) 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 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'} 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'}