Code Monkey home page Code Monkey logo

zbx_disk_stat's Introduction

ZBX_Disk_Stat

Send statistic from /proc/diskstats to Zabbix without any additional package and program

This is small project for my Home server

Features

  • 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 user vg00-lv_root
    • After reboot dm-1 may change to dm-2, but stat will be correct

Install

  1. 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, Debian-10(buster), 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
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
  1. Import Template_ZBX/ZBX_Disk_Stat.xml
  2. 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
  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

  • 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

Debug Command

Test Discovery

zabbix_get -s <IP|Server_Name> -k custom.blkdev.discovery |jq .

Get statistic

zabbix_get -s <IP|Server_Name> -k custom.blkdev.all_stat[vg00-lv_root] | jq .

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

ToDo

  1. Add link with information about maximum IO_time

zbx_disk_stat's People

Contributors

dusharu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.