(1)被监控端配置
#vi /etc/zabbix/zabbix_agentd.conf UnsafeUserParameters=1 UserParameter=custom.vfs.dev.read.ops[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$4}' UserParameter=custom.vfs.dev.write.ops[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$8}' 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}' #systemctl restart zabbix-agent.service
说明
custom.vfs.dev.read.ops[*] //磁盘读的次数 custom.vfs.dev.write.ops[*] //磁盘写的次数 custom.vfs.dev.read.sectors[*] //读速率 custom.vfs.dev.write.sectors[*] //写速率
(2)server端配置
1) 测试是否能够获取到正常的值
yum install zabbix-get -y zabbix_get -s 192.168.1.32 -k 'custom.vfs.dev.read.ops[sda]' zabbix_get -s 192.168.1.32 -k 'custom.vfs.dev.write.ops[sda]' zabbix_get -s 192.168.1.32 -k 'custom.vfs.dev.read.sectors[sda]' zabbix_get -s 192.168.1.32 -k 'custom.vfs.dev.write.sectors[sda]'
2) zabbix web端配置读次数
名称:Disk:$1:Read:ops per second 键值:custom.vfs.dev.read.ops[sda] 单位:ops/second 进程:每秒更改
3) zabbix web端配置写次数
名称:Disk:$1:Write:ops per second 键值:custom.vfs.dev.write.ops[sda] 单位:ops/second 进程:每秒更改
4) zabbix web端配置读速率
名称:Disk:$1:Read:Bytes/sec 键值:custom.vfs.dev.read.sectors[sda] 单位:B/sec 进程:每秒更改和自定义倍数512(一个扇区512字节)
5) zabbix web端配置写速率
名称:Disk:$1:Write:Bytes/sec 键值:custom.vfs.dev.write.sectors[sda] 单位:B/sec 进程:每秒更改和自定义倍数512(一个扇区512字节)
6)创建图形
7)测试验证
dd if=/dev/zero of=1.log bs=1M count=100000