您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
1.磁盘发现脚本
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 $3}'|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] ];then printf ',' fi done printf "\n\t]\n" printf "}\n"
2.磁盘io状态脚本
vim disk_stats.sh #/bin/sh device=$1 item=$2 case $item in rrqm) /usr/bin/tail -n20 /tmp/iostat_output |grep "\b$device\b"|tail -1|awk '{print $2}' ;; 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}' ;; avgrq-sz) /usr/bin/tail -n20 /tmp/iostat_output |grep "\b$device\b" |tail -1|awk '{print $8}' ;; 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.增加用户自定义的参数表
vim /usr/local/zabbix-agent/etc/zabbix_agentd.conf #add the two lines UserParameter=disk.discovery[*],/bin/bash /usr/local/zabbix-agent/scripts/disk_io.sh UserParameter=disk.status[*],/bin/bash /usr/local/zabbix-agent/scripts/disk_stats.sh $1 $2
4.重启进程
/etc/init.d/zabbix_agentd restart
3.创建模板
4.创建discover rule
5.创建item prototype
6.创建Graph prototype
7.查看监控
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。