Zabbix監控磁盤io


Zabbix監控磁盤io

第1章 介紹

監控磁盤IO的基本原理:通過分析/proc/diskstats文件,來對IO的性能進行監控。

++++++++++++++++++++++++對/proc/diskstats的解釋++++++++++++++++++++++++++++++

# cat /proc/diskstats |grep sda |head -1

   8    0     sda 2280 1445 76478 11956 249 188 3490 932 0 9913 12805

 

第2章 修改客戶端配置文件

vim /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf

UnsafeUserParameters=1
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}'                       //花費在IO操作上的毫秒數
UserParameter=custom.vfs.dev.read.sectors[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$6}'             //讀扇區的次數(一個扇區的等於512B)
UserParameter=custom.vfs.dev.write.sectors[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$10}'          //寫扇區的次數(一個扇區的等於512B)



/etc/init.d/zabbix-agent restart 

第3章 服務端測試

[root@kvm2 ~]# /application/zabbix/bin/zabbix_get -s 192.168.1.76 -p 10050 -k 'custom.vfs.dev.read.ops[sda]'
37231
[root@kvm2 ~]# /application/zabbix/bin/zabbix_get -s 192.168.1.76 -p 10050 -k 'custom.vfs.dev.write.ms[sda]'
17553012
[root@kvm2 ~]# /application/zabbix/bin/zabbix_get -s 192.168.1.76 -p 10050 -k 'custom.vfs.dev.write.ops[sda]'
439045
[root@kvm2 ~]# /application/zabbix/bin/zabbix_get -s 192.168.1.76 -p 10050 -k 'custom.vfs.dev.read.ops[sda]' 
37231
[root@kvm2 ~]# /application/zabbix/bin/zabbix_get -s 192.168.1.76 -p 10050 -k 'custom.vfs.dev.read.sectors[sda]'
1444430
[root@kvm2 ~]# /application/zabbix/bin/zabbix_get -s 192.168.1.76 -p 10050 -k 'custom.vfs.dev.write.sectors[sda]'
20215608
[root@kvm2 ~]# 

第4章 Web端操作

4.1 將需要監控主機添加到群組之中

4.2 添加監控項

4.3 修改監控項(1)

 

4.4 修改監控項(2)

 

4.5 修改監控項(3)

 

4.6 修改監控項(4)

 

4.7 修改監控項(5)

 

4.8 修改監控項(6)

 

 

4.9 添加到郵件報警組


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM