设为首页 收藏本站
查看: 933|回复: 0

[经验分享] 如何用zabbix来监控磁盘IO?

[复制链接]

尚未签到

发表于 2019-1-21 12:06:35 | 显示全部楼层 |阅读模式
  我正在找关于磁盘IO监控的软件,看到这篇博客,经过测试后,确认可用(我使用zabbix 1.8.10)。关于模版,请下载附件
  原作者博客地址:
  http://www.muck.net/19/getting-hard-disk-performance-stats-from-zabbix
  http://www.muck.net/pub/zabbix_FileServer_template.xml
  I like zabbix… but it annoys me that it’s ops per second, and bytes per second data is broken for hard drives in the linux 2.6 kernel. So I created a work around
  Add the following code to your zabbix_agentd.conf file (/etc/zabbix/zabbix_agentd.conf by default), and restart the zabbix agent:
  UserParameter=custom.vfs.dev.read.ops
  • ,cat /proc/diskstats | grep $1 | head -1 | awk '{print $$4}'
      UserParameter=custom.vfs.dev.read.ms
  • ,cat /proc/diskstats | grep $1 | head -1 | awk '{print $$7}'
      UserParameter=custom.vfs.dev.write.ops
  • ,cat /proc/diskstats | grep $1 | head -1 | awk '{print $$8}'
      UserParameter=custom.vfs.dev.write.ms
  • ,cat /proc/diskstats | grep $1 | head -1 | awk '{print $$11}'
      UserParameter=custom.vfs.dev.io.active
  • ,cat /proc/diskstats | grep $1 | head -1 | awk '{print $$12}'
      UserParameter=custom.vfs.dev.io.ms
  • ,cat /proc/diskstats | grep $1 | head -1 | awk '{print $$13}'
      UserParameter=custom.vfs.dev.read.sectors
  • ,cat /proc/diskstats | grep $1 | head -1 | awk '{print $$6}'
      UserParameter=custom.vfs.dev.write.sectors
  • ,cat /proc/diskstats | grep $1 | head -1 | awk '{print $$10}'
  •   The names are pretty descriptive, but you can find more information on how to decipher /proc/diskstats here:http://www.kernel.org/pub/linux/kernel/people/landley/kdocs/Documentation/iostats.txt
      After you add the UserParameter’s to your config file, you can check that they work by using zabbix_get from your zabbix server:
      zabbix_get -s HostName -p 10050 -k custom.vfs.dev.write.ops[sdb]
      It should return a large number, and not something like: ZBX_NOTSUPPORTED. If it comes back not supported, make sure you restarted the agent after adding the userparameters. Then try running the commands outside of zabbix. Note that if you run the commands outsie of zabbix, you’ll need to replace the first $1 with a disk name, and remove one of the $ characters from the awk command.
      Once you’ve verfied everything is in working order, you can add it as an item to your zabbix installation:
      You can download my exported Template here , which will create a template called Template_app_FileServer. It will give you:
      Disk Read/Write: Bytes/sec (or KB, MB per second)
      Disk Read/Write: Ops/second
      Disk Read/Write: Milliseconds spent reading or writing
      Disk:IO currently executing
      Disk:IO ms: time spent performing IO
      第一步: 导入模版.
      第二步:修改内容(它默认监控了sdb,sbc这两个分区)
      第三步:上图(为了测试结果,我上传了8G的内容到我的物理机上了。)




    运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
    2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
    3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
    4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
    5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
    6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
    7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
    8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

    所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-665995-1-1.html 上篇帖子: zabbix服务端安装教程 下篇帖子: zabbix企业级分布式监控系统
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    扫码加入运维网微信交流群X

    扫码加入运维网微信交流群

    扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

    扫描微信二维码查看详情

    客服E-mail:kefu@iyunv.com 客服QQ:1061981298


    QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


    提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


    本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



    合作伙伴: 青云cloud

    快速回复 返回顶部 返回列表