一、zabbix-agent 端配置
[root@zabbix zabbix_agentd.d]# pwd
/etc/zabbix/zabbix_agentd.d
[root@zabbix zabbix_agentd.d]# vim host_IO_status.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}'
custom.vfs.dev.read.ops[*]
:磁盤讀的次數custom.vfs.dev.write.ops[*]
:磁盤寫的次數custom.vfs.dev.read.sectors[*]
:磁盤讀的速率custom.vfs.dev.write.sectors[*]
:磁盤寫的速率
二、zabbix-server 端配置
1、測試是否能夠獲取到正常的值
[root@zabbix ~]# zabbix_get -s 192.168.1.111 -k 'custom.vfs.dev.read.ops[sda]'
9127
[root@zabbix ~]# zabbix_get -s 192.168.1.111 -k 'custom.vfs.dev.write.ops[sda]'
100739
[root@zabbix ~]# zabbix_get -s 192.168.1.111 -k 'custom.vfs.dev.read.sectors[sda]'
681344
[root@zabbix ~]# zabbix_get -s 192.168.1.111 -k 'custom.vfs.dev.write.sectors[sda]'
4969103
2、zabbix-web端添加模板
3、創建應用集
4、創建監控項
zabbix web端配置讀次數
名稱:Disk:$1:Read:ops per second
鍵值:custom.vfs.dev.read.ops[sda]
單位:ops/second
進程:每秒更改
zabbix web端配置寫次數
名稱:Disk:$1:Write:ops per second
鍵值:custom.vfs.dev.write.ops[sda]
單位:ops/second
進程:每秒更改
zabbix web端配置讀速率
名稱:Disk:$1:Read:Bytes/sec
鍵值:custom.vfs.dev.read.sectors[sda]
單位:B/sec
進程:每秒更改和自定義倍數512(一個扇區512字節)
zabbix web端配置寫速率
名稱:Disk:$1:Write:Bytes/sec
鍵值:custom.vfs.dev.write.sectors[sda]
單位:B/sec
進程:每秒更改和自定義倍數512(一個扇區512字節)
5、創建圖形
disk-io-rw-count
disk-io-rw-rate
6、查看IO狀態信息
disk-io-rw-count
disk-io-rw-rate
7、測試驗證
[root@zabbix ~]# dd if=/dev/zero of=1.log bs=1M count=100000
記錄了21429+0 的讀入
記錄了21428+0 的寫出
22468886528字節(22 GB)已複製,27.1362 秒,828 MB/秒