dusharu / ZBX_Disk_Stat

Send statistic from /proc/diskstats to Zabbix
GNU General Public License v3.0
7 stars 5 forks source link

ZBX_Disk_Stat

Send statistic from /proc/diskstats to Zabbix

This is small project for my Home server

Features

Requires

Install

  1. Add script to server
# Create dir for zabbix sript
mkdir -p /usr/libexec/zabbix/

# Copy script to your server
curl 'https://raw.githubusercontent.com/dusharu/ZBX_Disk_Stat/master/scripts/disk_stat.sh' -o /usr/libexec/zabbix/disk_stat.sh
chmod 755 /usr/libexec/zabbix/disk_stat.sh
  1. Import Template_ZBX/latest/ZBX_Disk_Stat.xml
  2. Check LLD Override. Default value:
    • ^$ - 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
  3. Add host to group "Disk_Stat: io_block_dev"
  4. Wait before Zabbix Discovery and Get Some Data

Screenshoot

Graph create by Grafana and Zabbix plugin 1-Disk_Stat_IOPS.png 2-Disk_Stat_RW_Sectors.png 3-Disk_Stat_IO_time.png 4-Disk_Stat_IO_Queue.png

Graph create by Zabbix 10-Disk_Stat_IOPS_zbx.png 11-Disk_Stat_IO_Queue_zbx.png 12-Disk_Stat_RW_Sectors_zbx.png

Files

Debug Command

Print HELP

zabbix_get -s <HOST> -k 'system.run[ "/usr/libexec/zabbix/disk_stat.sh" ]'

Discovery

zabbix_get -s <HOST> -k 'system.run[ "/usr/libexec/zabbix/disk_stat.sh blkdev_discovery" ]'

Get statistic

zabbix_get -s <HOST> -k 'system.run[ "/usr/libexec/zabbix/disk_stat.sh blkdev_all_stat <DISK>" ]'

Docs

  1. kernel.org: Describe /proc/diskstats
  2. kernel.org: I/O statistics fields
  3. Wikipedia.org: maximum IOPS on different Disk
  4. RAID calcuator
  5. Linux Filesystem Hierarchy Standard: /usr/libexec

ToDo

  1. Add link with information about maximum IO_time
  2. Add plugin for zabbix_agent2