Send statistic from /proc/diskstats to Zabbix without any additional package and program
This is small project for my Home server
- AutoDiscovery BlockDev and Filter by global regexp: block_dev_filter
- Collect Read\Write Operations per second
- Collect Read\Write Sectors per second
- Calculate Time for 1 Read\Write Operations
- Trigger when IO_Time >30ms at last 5min
- Collect IO Queue
- Convert DM(Device Mapper) device to pretty Name
- Get stat for
dm-1
but print for uservg00-lv_root
- After reboot
dm-1
may change todm-2
, but stat will be correct
- Get stat for
- Not work with Zabbix_agent2
- Add parametrs to zabbix-agent.conf
#### enable Include in config
# /etc/zabbix/zabbix_agentd.conf
echo "Include=/etc/zabbix-agent.d/*.conf" >> /etc/zabbix/zabbix_agentd.conf
#### copy config
mkdir -p /etc/zabbix-agent.d/ && cd /etc/zabbix-agent.d/
# For RHEL/CentOS-8, Ubuntu-18.04(Xenial), Gentoo
curl -O 'https://raw.githubusercontent.com/dusharu/ZBX_Disk_Stat/master/config_zabbix-agent/Disk_Stat.conf'
# For old system and Debian
curl -o Disk_Stat.conf 'https://raw.githubusercontent.com/dusharu/ZBX_Disk_Stat/master/config_zabbix-agent/Disk_Stat_awk.conf'
#### restart zabbix-agent
# RHEL/CentOS
systemctl restart zabbix-agentd
# Debian/Ubuntu
systemctl restart zabbix-agent
# Gentoo
/etc/init.d/zabbix-agentd restart
- Import Template_ZBX/ZBX_Disk_Stat.xml
- Create global regexp: block_dev_filter
- ^$ - result FALSE - device was remove
- .snapshot. - result FALSE - filter LVM snapshot
- -real$ - result FALSE - filter LVM snapshot
- -cow$ - result FALSE - filter LVM snapshot
- ^xvd[a-z]*[0-9]+$ - result FALSE - filter partitions
- ^[hs]d[a-z]*[0-9]+$ - result FALSE - filter partitions
- ^loop[0-9]*$ - result FALSE - filter loop device
- ^sr[0-9]*$ - result FALSE - filter CD-ROM
- Add host to group "Disk_Stat: io_block_dev"
- Wait before Zabbix Discovery and Get Some Data
Graph create by Grafana and Zabbix plugin
- config_zabbix-agent - config for zabbix Agent
- Disk_Stat.conf - default config
- Disk_Stat_awk.conf - for backward compatibility with old Distros(with linux-utils version < 2.30)
- Template_ZBX - Zabbix Template
- Develop - information for Developers
- README.md - information for Users
- Screenshoots - Screensoot for README.md
- LICENSE - license file
zabbix_get -s <IP|Server_Name> -k custom.blkdev.discovery |jq .
zabbix_get -s <IP|Server_Name> -k custom.blkdev.all_stat[vg00-lv_root] | jq .
- kernel.org: Describe /proc/diskstats
- kernel.org: I/O statistics fields
- Wikipedia.org: maximum IOPS on different Disk
- RAID calcuator
- Add link with information about maximum IO_time
- Add plugin for zabbix_agent2