zoukankan      html  css  js  c++  java
  • zabbix添加磁盘IO监控

    1,定义获取值的 disk_stat.conf配置文件

     cat disk_stat.conf

    UserParameter=custom.vfs.discover_disks,/usr/local/zabbix_agents_3.2.7/scripts/disk_discovery.py
    UserParameter=custom.vfs.dev.read.ops[*],awk '{print $$1}' /sys/class/block/$1/stat
    UserParameter=custom.vfs.dev.read.merged[*],awk '{print $$2}' /sys/class/block/$1/stat
    UserParameter=custom.vfs.dev.read.sectors[*],awk '{print $$3}' /sys/class/block/$1/stat
    UserParameter=custom.vfs.dev.read.ms[*],awk '{print $$4}' /sys/class/block/$1/stat
    UserParameter=custom.vfs.dev.write.ops[*],awk '{print $$5}' /sys/class/block/$1/stat
    UserParameter=custom.vfs.dev.write.merged[*],awk '{print $$6}' /sys/class/block/$1/stat
    UserParameter=custom.vfs.dev.write.sectors[*],awk '{print $$7}' /sys/class/block/$1/stat
    UserParameter=custom.vfs.dev.write.ms[*],awk '{print $$8}' /sys/class/block/$1/stat
    UserParameter=custom.vfs.dev.io.active[*],awk '{print $$9}' /sys/class/block/$1/stat
    UserParameter=custom.vfs.dev.io.ms[*],awk '{print $$10}' /sys/class/block/$1/stat
    UserParameter=custom.vfs.dev.weight.io.ms[*],awk '{print $$11}' /sys/class/block/$1/stat

    2,添加python拉取值得python脚本

    disk_discovery.py

    #!/usr/bin/python
    import os
    import json

    if __name__ == "__main__":
    # Iterate over all block devices, but ignore them if they are in the
    # skippable set
    skippable = ("sr", "loop", "ram")
    devices = (device for device in os.listdir("/sys/class/block")
    if not any(ignore in device for ignore in skippable))
    data = [{"{#DEVICENAME}": device} for device in devices]
    print(json.dumps({"data": data}, indent=4))

    ,3,将Include=/usr/local/zabbix_agents_3.2.7/*.conf放入zabbix_agent.conf的最后一行

    4,重启zabbix

  • 相关阅读:
    【译文】纯HTML5捕获音频流和视频流
    Vue中scoped属性浅析
    jmeter 在liunx 环境下的测试问题汇总
    windows Jmeter 安装环境配置
    基于ghz 对grpc 服务进行压测
    使用powershell脚本自动发布
    SqlServer 重建索引脚本
    配置nginx代理本地多个站点到制定域名
    Xposed 插件开发入门教程(一)
    python 字典
  • 原文地址:https://www.cnblogs.com/wanganshi/p/10294541.html
Copyright © 2011-2022 走看看