磁盘IO:
单位时间内读写数据量
单位时间内读写次数
取值脚本:
#!/use/bin/env python
#coding:utf-8
# Description:for zabbix discovery disk partition on linux machine
import os
import re,json
cmd = """cat /proc/diskstats |grep -E ‘\ssd[a-z]\s|\sxvd[a-z]\s|\svd[a-z]\s‘|awk ‘{print $3}‘|sort|uniq"""
disks = []
def get_disks():
f = os.popen(cmd)
for disk in f.readlines():
disks.append({‘{#DISK_NAME}‘:disk.strip()})
return disks
if __name__ == "__main__":
datas = get_disks()
print json.dumps({‘data‘:datas},sort_keys=True,indent=4,separators=(‘,‘,‘:‘))
原文地址:http://blog.51cto.com/11424123/2126751
时间: 2024-11-07 20:21:55