Zabbix监控disk performance
概述
zabbix获取/sys里面的磁盘信息并分析来监控disk performance
sysfs是Linux内核中设计较新的一种虚拟的基于内存的文件系统,它的作用与 proc 有些类似(默认挂载在/sys)
sysfs is a pseudo file system provided by the Linux kernel that exports information about various kernel subsystems, hardware devices, and associated device drives from the kernel's device model to user space through virtual files. In addition to providing information about various devices and kernel subsystems, exported virtual files are also used for their configuring. (维基百科的解释)
原理
查看磁盘,分区状态值的统计信息
/sys/block/<dev>/stat
[root@test ~]# cat /sys/class/block/sda/stat
Field Name units description
----- ---- ----- -----------
read I/Os requests number of read I/Os processed
read merges requests number of read I/Os merged with in-queue I/O
read sectors sectors number of sectors read
read ticks milliseconds total wait time for read requests
write I/Os requests number of write I/Os processed
write merges requests number of write I/Os merged with in-queue I/O
write sectors sectors number of sectors written
write ticks milliseconds total wait time for write requests
in_flight requests number of I/Os currently in flight
io_ticks milliseconds total time this block device has been active
time_in_queue milliseconds total wait time for all requests
merge:读取/写请求有多少被Merge了(当系统调用需要读取/写数据的时候, VFS将请求发到各个分区, 如果分区发现不同的读取/写请求的是相同Block的数据,
FS会将这个请求合并Merge),所以磁盘读写吞吐量(throughput)= 读写扇区(field3,7)次数 * 扇区大小 / 时间s,而不是读写merge后的iops(field1,5)
ps: 除了Field 9其他的Field都是自上次系统启动后的累加值
配置
定义zabbix监控item的配置文件
# disk_discovery
UserParameter=custom.vfs.discover_disks,/m2odata/server/zabbix-agent/scripts/lld-disks.py
# disk_stats
UserParameter=custom.vfs.dev.read.ops[*],awk '{print $$1}' /sys/class/block/$/stat
UserParameter=custom.vfs.dev.read.merged[*],awk '{print $$2}' /sys/class/block/$/stat
UserParameter=custom.vfs.dev.read.sectors[*],awk '{print $$3}' /sys/class/block/$/stat
UserParameter=custom.vfs.dev.read.ms[*],awk '{print $$4}' /sys/class/block/$/stat
UserParameter=custom.vfs.dev.write.ops[*],awk '{print $$5}' /sys/class/block/$/stat
UserParameter=custom.vfs.dev.write.merged[*],awk '{print $$6}' /sys/class/block/$/stat
UserParameter=custom.vfs.dev.write.sectors[*],awk '{print $$7}' /sys/class/block/$/stat
UserParameter=custom.vfs.dev.write.ms[*],awk '{print $$8}' /sys/class/block/$/stat
UserParameter=custom.vfs.dev.io.active[*],awk '{print $$9}' /sys/class/block/$/stat
UserParameter=custom.vfs.dev.io.ms[*],awk '{print $$10}' /sys/class/block/$/stat
UserParameter=custom.vfs.dev.weight.io.ms[*],awk '{print $$11}' /sys/class/block/$/stat
磁盘自动发现规则
lld-disk.py
#!/usr/bin/env python import os
import re
import json def Devices(diskdir, skippable):
raw_devices = (device for device in os.listdir(diskdir) if not any(ignore in device for ignore in skippable))
devices = (device for device in raw_devices if re.match(r'^\w{3}$', device)) # 保留整块磁盘 去掉分区, such as remove sda1 sdb2
data = [{"{#DEVICENAME}": device} for device in devices]
print(json.dumps({"data": data}, indent=4)) if __name__ == "__main__":
# Iterate over all block devices, but ignore them if they are in the skippable set
diskdir = "/sys/class/block"
skippable = ("sr", "loop", "ram", "dm")
Devices(diskdir, skippable)
重启zabbix_agentd使配置文件生效
服务器端 # 创建监控disk模板(Template Disk Performance)
Discovery rule

Item prototypes

创建Graph prototype(iops,throughput)

查看graph
zabbix后台 Monitoring->Graphs->对应的graph

参考:
/sys/block/<dev>/stat: https://www.kernel.org/doc/Documentation/block/stat.txt
/proc/diskstats: https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats
iostat: https://www.kernel.org/doc/Documentation/iostats.txt
github: https://github.com/grundic/zabbix-disk-performance
Zabbix监控disk performance的更多相关文章
- Zabbix监控mysql performance
介绍 zabbix监控mysql性能,使用zabbix自带的mysql监控模板,可以监控以下内容OPS(增删改查).mysql慢查询数量.mysql请求\响应流量带宽 配置 新建mysql监控用户 G ...
- 使用percona-xtrabackup实现对线上zabbix监控系统数据库mariadb5.5.47的主从同步
使用percona-xtrabackup实现对线上zabbix监控系统数据库的主从同步 业务背景: zabbix3.0.4是业务的主要监控,部署在一台单机中,为避免数据丢失先对其做数据主从同步,因主数 ...
- zabbix监控Oracle
可监控项 使用zabbix监控oracle数据库需要借助第三方的插件,目前使用较多的是orabbix.目前维护到了1.2.3版本.关于oracle自带的监控项目有以下几个: DB Version (i ...
- zabbix监控Mysql中的QPS/TPS
今天我们来了解一下如何通过zabbix监控来监控我们msyql数据库中的TPS和QPS,提到这两个概念,我们先来了解究竟什么是QPS,TPS呢?它们是如何计算得到的呢?我们来看一下 QPS(Quest ...
- contos7 使用zabbix监控物理磁盘状态实例
一.系统环境: 物理机:dell R640 操作系统:centos7 二.安装MegaCli 监控主要是通过MegaCli 软件获取到物理主机的read及硬盘相关状态信息.然后通过zabbix的自定义 ...
- 【zabbix告警监控】配置zabbix监控nginx服务
zabbix监控nginx,nginx需要添加--with-http_stub_status模块 使用zabbix监控nginx,首先nginx需要配置开启ngx_status.但是我这边nginx安 ...
- 01.Zabbix监控快速入门
1.监控知识基本概述 1.为什么要使用监控 1.对系统不间断实时监控 2.实时反馈系统当前状态 3.保证服务可靠性安全性 4.保证业务持续稳定运行 2.如何进行监控,比如我们需要监控磁盘的使用率 1. ...
- zabbix监控添加学习笔记
在实际生产环境中,除了CPU.内存等一些系统信息可以挂载zabbix的自带模板Template OS Linux:但是一些公司开发的定制服务需要自己写模板或者监控项去监控: 一.监控公司的java服务 ...
- 使用Zabbix监控Oracle数据库
Orabbix介绍 监控Oracle数据库我们需要安装第三方提供的Zabbix插件,我们先测试比较有名的Orabbix,http://www.smartmarmot.com/product/orabb ...
随机推荐
- Symantec Backup Exec 2012 Agent For Linux安装
Backup Exec 2012 介绍 Backup Exec 2012 是一种为虚拟和物理环境提供保护的集成产品,能够简化备份和灾难恢复,并提供了无可匹敌的恢复功能.借助于强大的 Symantec ...
- MySQL初始化的正确姿势
1. 背景 mysql安装教程很多,但是有不少讲得过于简单,没有考虑到安全问题.比如说,一些教程里,只设置一个root用户,并且对外网公开,一来容易被破解密码(用户名固定,破解难度自然降了一大截,而且 ...
- PostgreSQL-join多表连接查询和子查询
一.多表连接查询 1.连接方式概览 [inner] join 内连接:表A和表B以元组为单位做一个笛卡尔积,记为表C,然后在C中挑选出满足符合on 语句后边的限制条件的内容. left [outer] ...
- 【Linux学习】Linux操作技巧
linux 删除已输入的命令 ctl + u 删除光标以前的字符 ctl + k 删除光标以后的字符 ctl + a 移动光标至的字符头 ctl + e 移动光标至的字符尾 ctrl + w 往回删除 ...
- js中数组遍历for与for in区别(强烈建议不要使用for in遍历数组)
js中遍历数组的有两种方式 var array=['a'] //标准的for循环 for(var i=1;i<array.length;i++){ alert(array[i]) } //for ...
- [转]一种简单的js时间控件
使用方法: 粘贴代码到文本文档中,文档名称为datetime.js,然后在html文件中引用如下代码即可 <input name="shijian1" id="sh ...
- 全面剖析 <input> 标签 ------ HTML\HTML5
<input>标签因其形式多样.功能强大,当之无愧成为了WEB前端开发人员最钟爱的元素之一.下面就来对<input>做一个全面的剖析: 标签定义: <input> ...
- thinkphp发送邮件
看thinkPHP手册发送邮件 Thinkphp3.2 PHPMailer 发送邮件结合QQ企业邮箱发送邮件下载附件PHPMailer解压到ThinkPHP\Library\VendorPHPMail ...
- [2016湖南长沙培训Day4][前鬼后鬼的守护 chen] (动态开点线段树+中位数 or 动规 or 贪心+堆优化)
题目大意 给定一个长度为n的正整数序列,令修改一个数的代价为修改前后两个数的绝对值之差,求用最小代价将序列转换为不减序列. 其中,n满足小于500000,序列中的正整数小于10^9 题解(引自mzx神 ...
- iOS重一些常用的代理模式
(一)代理模式 应用场景:当一个类的某些功能需要由别的类来实现,但是又不确定具体会是哪个类实现.优势:解耦合敏捷原则:开放-封闭原则实例:tableview的 数据源delegate,通过和proto ...