天天看点

zabbix监控磁盘性能

1.在zabbix_agentd.conf增加以下的代码:

UserParameter=custom.vfs.dev.read.ops[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$4}'

UserParameter=custom.vfs.dev.read.ms[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$7}'

UserParameter=custom.vfs.dev.write.ops[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$8}'

UserParameter=custom.vfs.dev.write.ms[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$11}'

UserParameter=custom.vfs.dev.io.active[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$12}'

UserParameter=custom.vfs.dev.io.ms[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$13}'

UserParameter=custom.vfs.dev.read.sectors[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$6}'

UserParameter=custom.vfs.dev.write.sectors[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$10}'

[root@localhost ~]# /etc/init.d/zabbix_agentd restart

3.在 zabbix server 中测试是否有能获取数据,使用以下命令进行测试,其中AgentServerIP为被监控主机的IP;如果出现ZBX_NOTSUPPORTED,请确认你已增加了以上代码并重启了服务再检查防火墙的情况.

zabbix_get -s AgentServerIP -p 10050 -k custom.vfs.dev.write.ops[sda]

例:

[root@zabbix-server ~]# zabbix_get -s 192.168.209.251 -p 10050 -k custom.vfs.dev.write.ops[sda]

50184

4.导入下载的模板,下载地址:http://www.muck.net/pub/zabbix_FileServer_template.xml

继续阅读