服務器監控之zabbix監控IO篇

下面介紹的是用zabbix監控Liunx服務器的IO讀寫情況. zabbix的安裝以前的博客有, 大家可以參考;

1、 添加userparameter_io.conf配置文件

在/etc/zabbix/zabbix_agentd.d下添加userparameter_io.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}'  

2.、重啓zabbix-agent服務

# service zabbix-agent restart  

3、測試zabbix-server獲取數據

#zabbix_get -s 目標服務器IP -p 10050 -k custom.vfs.dev.write.ops[sda]  

4、配置zabbix-server模板
服務器監控之zabbix監控IO篇

5.、配置zabbix-server項目(item)

第一個指標Name: Disk:$1:Read:Bytes/sec
Key: custom.vfs.dev.read.sectors[sda]
Units: B/sec
Store value: speed per second //會進行差值計算
Use custom multiplier 512 //會對值乘以512,因爲這裏是一個扇區,轉換爲字節爲512B

同理,其他指標方式,添加如下:
第二個指標:Name: Disk:$1:Write:Bytes/sec
Key: custom.vfs.dev.write.sectors[sda]
Units: B/sec
Store value: speed per second
Use custom multiplier 512
服務器監控之zabbix監控IO篇
第三個指標:Name: Disk:$1:Read:ops per second
Key: custom.vfs.dev.read.ops[sda]
Units: ops/second
Store value: speed per second

第四個指標:Name: Disk:$1:Write:ops per second
Key: custom.vfs.dev.write.ops[sda]
Units: ops/second
Store value: speed per second

第五個指標:Name: Disk:$1:Read:ms
Key: custom.vfs.dev.read.ms[sda]
Units: ms
Store value: speed per second

第六個指標:Name: Disk:$1:Write:ms
Key: custom.vfs.dev.write.ms[sda]
Units: ms
Store value: speed per second

6.、添加zabbix-server圖形(Graphs)
服務器監控之zabbix監控IO篇

7、效果圖展示
服務器監控之zabbix監控IO篇

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章