首页 > 系统服务 > 详细

Zabbix监控Linux磁盘I/O

时间:2014-06-20 19:30:18      阅读:516      评论:0      收藏:0      [点我收藏+]
东西都上传到这里了:
 

需要用到的东西:

 
1、修改agent配置
我的agent安装位置是/usr/local/zabbixagent/
vi /usr/local/zabbixagent/conf/zabbix_agentd.conf
Include=/usr/local/zabbixagent/conf/zabbix_agentd
:wq
 
2、建立配置文件
此文件位置在/usr/local/zabbixagent/conf/zabbix_agentd/sysio.conf
# required sysstat
# required iostat running backgroud
##################################################
# nohup iostat -k -x -d 30 > /usr/local/zabbixagent/tmp/iostats &
# chown zabbix:zabbix /usr/local/zabbixagent/tmp/iostats
# cronteb -e
# Zabbix Agents task for disk I/O
# 59 23 * * * iostat -k -x -d 30 2 > /usr/local/zabbixagent/tmp/iostats &
##################################################
# command for test.
#/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.rps[sda]
#/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.wps[sda]
#/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.rkbps[sda]
#/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.wkbps[sda]
#/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.avgrq-sz[sda]
#/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.avgqu-sz[sda]
#/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.await[sda]
#/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.svctm[sda]
#/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.util[sda]
##################################################
UserParameter=io.scandisk[*],/usr/local/zabbixagent/scripts/discovery-linux.py /proc/diskstats 3
UserParameter=io.rps[*],grep -a "$1" /usr/local/zabbixagent/tmp/iostats | tail -1 |awk {print $$4}
UserParameter=io.wps[*],grep -a "$1" /usr/local/zabbixagent/tmp/iostats | tail -1 |awk {print $$5}
UserParameter=io.rkbps[*],grep -a "$1" /usr/local/zabbixagent/tmp/iostats | tail -1 |awk {print $$6}
UserParameter=io.wkbps[*],grep -a "$1" /usr/local/zabbixagent/tmp/iostats | tail -1 |awk {print $$7}
UserParameter=io.avgrq-sz[*],grep -a "$1" /usr/local/zabbixagent/tmp/iostats | tail -1 |awk {print $$8}
UserParameter=io.avgqu-sz[*],grep -a "$1" /usr/local/zabbixagent/tmp/iostats | tail -1 |awk {print $$9}
UserParameter=io.await[*],grep -a "$1" /usr/local/zabbixagent/tmp/iostats | tail -1 |awk {print $$10}
UserParameter=io.svctm[*],grep -a "$1" /usr/local/zabbixagent/tmp/iostats | tail -1 |awk {print $$11}
UserParameter=io.util[*],grep -a "$1" /usr/local/zabbixagent/tmp/iostats | tail -1 |awk {print $$12}

 

 
3、misc
cd /usr/local/zabbixagent/
mkdir tmp scripts
chmod 775 tmp scripts
touch tmp/iostats
chmod 644 tmp/iostats
touch scripts/discovery-linux.py
chmod 754 scripts/discovery-linux.py
chown zabbix:zabbix ./* -R
 
4、运行
nohup iostat -k -x -d 30 > /usr/local/zabbixagent/tmp/iostats &
sudo service zabbix_agentd restart
 
5、测试
/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.rps[sda]
/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.wps[sda]
/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.rkbps[sda]
/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.wkbps[sda]
/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.avgrq-sz[sda]
/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.avgqu-sz[sda]
/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.await[sda]
/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.svctm[sda]
/usr/local/zabbixagent/bin/zabbix_get -s 10.0.0.1 -k io.util[sda]

 

6、添加清理脚本
crontab -e
59 8 * * * iostat -k -x -d 30 2 > /usr/local/zabbixagent/tmp/iostats &

 

7、添加配置
blablabla,这里我就不说了。

Zabbix监控Linux磁盘I/O,布布扣,bubuko.com

Zabbix监控Linux磁盘I/O

原文:http://www.cnblogs.com/rexkang/p/zabbix-monitor-disk-io-of-linux.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!