1. Disk Discovery Scripts
Vim disk_io.sh #!/bin/bash diskarray= (' cat/proc/diskstats |grep-e ' \bsd[a-z]\b|\bxvd[a-z]\b|\bvd[a-z]\b ' |awk ' {print $ ' |sort|uniq 2>/dev/null ') length=${#diskarray [@]}printf "{\ n" printf ' \ t ' "\" data\ ": [" for (i=0;i< $length; i+ +) do printf ' \n\t\t{' printf "\" {#DISK_NAME}\ ": \" ${diskarray[$i]}\ "}" if [$i-lt $[$length-1]];the n printf ', ' fidoneprintf ' \n\t]\n "printf"}\n "
2. Disk IO Status Script
vim disk_stats.sh #/bin/sh device=$1item=$2 case $item in &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;RRQM) /usr/bin/tail -n20 /tmp/iostat_output |grep "\b$device\b" |tail -1|awk ' { print $2} ' ;; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;WRQM) /usr/bin/tail -n20 /tmp/iostat_output |grep "\b$device\b" |tail -1|awk ' {print $3} ' ;; rps) /usr/bin/tail -n20 /tmp/iostat_output |grep "\b$device\b" | tail -1|awk ' {print $4} ' ;; wps) /usr/bin/tail -n20 /tmp/iostat_output |grep "\b$device\b" |tail -1|awk ' {print $5} ' ;; rkbps) /usr/bin/tail -n20 /tmp/iostat_output |grep "\b$device\b" |tail -1|awk ' {print $6} ' ;; wkbps) /usr/bin/tail -n20 /tmp/iostat_output |grep "\b$device\b" |tail -1|awk ' {print $7} ' ;; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;AVGRQ-SZ) /usr/bin/tail -n20 /tmp/iostat_output |grep "\b$device\b" |tail -1|awk ' {print $8} ' ;; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;AVGQU-SZ) /usr/bin/tail -n20 /tmp/iostat_output |grep "\b$device\b" |tail -1|awk ' {print $9} ' ;; await) /usr/bin/tail -n20 /tmp/iostat_output |grep "\b$device\b" |tail -1|awk ' {print $10} ' ;; svctm) /usr/ bin/tail -n20 /tmp/iostat_output |grep "\b$device\b" |tail -1|awk ' {print $11} ' ;; util) /usr/bin/tail -n20 /tmp/iostat_output |grep "\b$device\b" | tail -1|awk ' {print $12} ' ;; Esac
3. Add user-defined parameter table
Vim/usr/local/zabbix-agent/etc/zabbix_agentd.conf#add the linesuserparameter=disk.discovery[*],/bin/bash/usr/ local/zabbix-agent/scripts/disk_io.shuserparameter=disk.status[*],/bin/bash/usr/local/zabbix-agent/scripts/ Disk_stats.sh $
4. Restart the process
/etc/init.d/zabbix_agentd restart
3. Create a template
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/8C/BD/wKiom1h17dKxNayzAACl6-qeexc181.png "title=" I1.png "alt=" Wkiom1h17dkxnayzaacl6-qeexc181.png "/>
4. Create Discover Rule
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/8C/BD/wKiom1h17eOReEIjAABZEsqETHk597.png "title=" I2.png "alt=" Wkiom1h17eoreeijaabzesqethk597.png "/>
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8C/BD/wKiom1h17fewuk0PAABjd0HwR0c799.png "title=" I3.png "alt=" Wkiom1h17fewuk0paabjd0hwr0c799.png "/>
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/8C/BD/wKiom1h17hKQnzWJAACG4SMtiEQ700.png "title=" I4.png "alt=" Wkiom1h17hkqnzwjaacg4smtieq700.png "/>5. Create Item prototype
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/8C/BD/wKiom1h17knx8MrBAABhxBJJ_qI675.png "title=" I5.png "alt=" Wkiom1h17knx8mrbaabhxbjj_qi675.png "/>650" this.width=650; "src=" https://s2.51cto.com/wyfs02/M00/ 8c/bd/wkiom1h17luzqmnzaac9fmuw9ne537.png "title=" I6.png "alt=" Wkiom1h17luzqmnzaac9fmuw9ne537.png "/>
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/8C/BD/wKiom1h17pLy8w3bAAA8hpo00cU246.png "title=" I7.png "alt=" Wkiom1h17ply8w3baaa8hpo00cu246.png "/>
6. Create Graph prototype
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/8C/B9/wKioL1h17tvCzaJhAABmkl0WdX8119.png "style=" float : none; "title=" I8.png "alt=" Wkiol1h17tvczajhaabmkl0wdx8119.png "/>
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8C/BD/wKiom1h17tywnRbqAADsKXYIp5g062.png "style=" float : none; "title=" I9.png "alt=" Wkiom1h17tywnrbqaadskxyip5g062.png "/>
7. View Monitoring
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/8C/BD/wKiom1h170aQDg2vAAF6gw8s-dc541.png "title=" I10.png "alt=" Wkiom1h170aqdg2vaaf6gw8s-dc541.png "/>
This article is from the "take a deep Breath again" blog, make sure to keep this source http://ckl893.blog.51cto.com/8827818/1891127
Zabbix monitoring disk IO (ii)