Zabbix监控Linux磁盘I/O
需要用到的东西:
vi /usr/local/zabbixagent/conf/zabbix_agentd.conf Include=/usr/local/zabbixagent/conf/zabbix_agentd :wq
# 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 Agent‘s 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}‘
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
nohup iostat -k -x -d 30 > /usr/local/zabbixagent/tmp/iostats & sudo service zabbix_agentd restart
/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]‘
crontab -e 59 8 * * * iostat -k -x -d 30 2 > /usr/local/zabbixagent/tmp/iostats &
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。