zabbix3.2监控磁盘IO

[root@qas-zabbix /]# cat /proc/diskstats |grep sda |head -1
   8       0 sda 11326 606 614426 192049 97057 701 4470335 1668343 0 602621 1858257

一至第三个域,分别是主设备号,次设备号,设备名称
第4个域:读完成次数 ----- 读磁盘的次数,成功完成读的总次数。 
(number of issued reads. This is the total number of reads completed successfully.)

第5个域:合并读完成次数, 第9个域:合并写完成次数。为了效率可能会合并相邻的读和写。从而两次4K的读在它最终被处理到磁盘上之前可能会变成一次8K的读,才被计数(和排队),因此只有一次I/O操作。这个域使你知道这样的操作有多频繁。
(number of reads merged)

第6个域:读扇区的次数,成功读过的扇区总次数。 
(number of sectors read. This is the total number of sectors read successfully.)

第7个域:读花费的毫秒数,这是所有读操作所花费的毫秒数(用__make_request()到end_that_request_last()测量)。
(number of milliseconds spent reading. This is the total number of milliseconds spent by all reads (as measured from __make_request() to end_that_request_last()).)

第8个域:写完成次数 ----写完成的次数,成功写完成的总次数。
(number of writes completed. This is the total number of writes completed successfully.)

第9个域:合并写完成次数 -----合并写次数。
(number of writes merged Reads and writes which are adjacent to each other may be merged for efficiency. Thus two 4K reads may become one 8K read before it is ultimately handed to the disk, and so it will be counted (and queued) as only one I/O. This field lets you know how often this was done.)

第10个域:写扇区次数 ---- 写扇区的次数,成功写扇区总次数。
(number of sectors written. This is the total number of sectors written successfully.)

第11个域:写操作花费的毫秒数  ---  写花费的毫秒数,这是所有写操作所花费的毫秒数(用__make_request()到end_that_request_last()测量)。
(number of milliseconds spent writing This is the total number of milliseconds spent by all writes (as measured from __make_request() to end_that_request_last()).)

第12个域:正在处理的输入/输出请求数 -- -I/O的当前进度,只有这个域应该是0。当请求被交给适当的request_queue_t时增加和请求完成时减小。
(number of I/Os currently in progress. The only field that should go to zero. Incremented as requests are given to appropriate request_queue_t and decremented as they finish.)

第13个域:输入/输出操作花费的毫秒数  ----花在I/O操作上的毫秒数,这个域会增长只要field 9不为0。
(number of milliseconds spent doing I/Os. This field is increased so long as field 9 is nonzero.)

第14个域:输入/输出操作花费的加权毫秒数 -----  加权, 花在I/O操作上的毫秒数,在每次I/O开始,I/O结束,I/O合并时这个域都会增加。这可以给I/O完成时间和存储那些可以累积的提供一个便利的测量标准。
(number of milliseconds spent doing I/Os. This field is incremented at each I/O start, I/O completion, I/O merge, or read of these stats by the number of I/Os in progress (field 9) times the number of milliseconds spent doing I/O since the last update of this field. This can provide an easy measure of both I/O completion time and the backlog that may be accumulating.)

磁盘读的次数         
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}' 
正在处理的输入/输出请求数(I/O的当前进度)        
UserParameter=custom.vfs.dev.io.active[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$12}'
花费在IO操作上的毫秒数          
UserParameter=custom.vfs.dev.io.ms[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$13}'
读扇区的次数(一个扇区的等于512B)              
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}'       
将需要监控的内容添加
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@qas-elk zabbix_agentd.d]# cat /etc/zabbix/zabbix_agentd.d/zabbix_linux_plugin.conf 
UserParameter=linux_status[*],/etc/zabbix/shells/zabbix_linux_plugin.sh "$1" "$2" "$3"

重新启动zabbix-agent服务器
[root@qas-elk ~]# systemctl restart  zabbix-agent.service
测试
zabbix_get -s 172.16.8.254 -p 10050 -k 'custom.vfs.dev.read.ops[sda]'
zabbix_get -s 172.16.8.254 -p 10050 -k 'custom.vfs.dev.write.ms[sda]'
zabbix_get -s 172.16.8.254 -p 10050 -k 'custom.vfs.dev.write.ops[sda]'
zabbix_get -s 172.16.8.253 -p 10050 -k 'custom.vfs.dev.write.ms[sda]'
zabbix_get -s 172.16.8.253 -p 10050 -k 'custom.vfs.dev.io.active[sda]'
zabbix_get -s 172.16.8.253 -p 10050 -k 'custom.vfs.dev.io.ms[sda]'
zabbix_get -s 172.16.8.253 -p 10050 -k 'custom.vfs.dev.read.sectors[sda]'
zabbix_get -s 172.16.8.253 -p 10050 -k 'custom.vfs.dev.write.sectors[sda]'

在zabbix服务器上执行结果

[root@qas-zabbix ~]# zabbix_get -s 172.16.8.254 -p 10050 -k 'custom.vfs.dev.write.ms[sda]'
13593365
[root@qas-zabbix ~]# zabbix_get -s 172.16.8.254 -p 10050 -k 'custom.vfs.dev.write.ops[sda]'
300692
[root@qas-zabbix ~]# zabbix_get -s 172.16.8.253 -p 10050 -k 'custom.vfs.dev.write.ms[sda]'
1702951
[root@qas-zabbix ~]# zabbix_get -s 172.16.8.253 -p 10050 -k 'custom.vfs.dev.io.active[sda]'
0
[root@qas-zabbix ~]# zabbix_get -s 172.16.8.253 -p 10050 -k 'custom.vfs.dev.io.ms[sda]'
609421
[root@qas-zabbix ~]# zabbix_get -s 172.16.8.253 -p 10050 -k 'custom.vfs.dev.read.sectors[sda]'
615314
[root@qas-zabbix ~]# zabbix_get -s 172.16.8.253 -p 10050 -k 'custom.vfs.dev.write.sectors[sda]'
4579867

zabbix web浏览器操作:










  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值