#!/usr/bin/python import re def get_memory(): i = 0 key_num = re.compile('\d+') with open('/proc/meminfo', 'r') as f: for line in f: if line.startswith('MemFree') or line.startswith('Buffers') or line.startswith('Cached'): num = key_num.findall(line) i += int(num[0]) return i if __name__ == '__main__': print(get_memory())
zabbix user parameters和Loadable modules的使用方法介绍 (2)
内容版权声明:除非注明,否则皆为本站原创文章。