檢查本地磁盤iops的腳本

#!/bin/bash
#####env  according to zhe system disk

raid_type=5
disk_iops=180
w_iops=`echo "${disk_iops} * 0.8/1 "|bc`
c_iops=`echo "${disk_iops} * 0.9/1"|bc`
disk_counts=3
#########
case $raid_type in
        1|10)
        iops=`/usr/bin/iostat -x 1 10|grep sda| awk '{sum=sum+$4+$5*2} END {print sum/10}'`
;;

        5)
        iops=`/usr/bin/iostat -x 1 10|grep sda| awk '{sum=sum+$4+$5*4} END {print sum/10}'`
;;
        *)
        echo error ;
;;
esac

current_echo=`echo "$iops/$disk_counts"|bc`
if [ "$current_echo" -gt "$c_iops" ] ;then
echo "iops crit" ${current_echo}
        exit 2
elif   [ $current_echo -gt $w_iops ] ;then
echo "iops warning" ${current_echo}
        exit 1
else
echo "iops ok" ${current_echo}
        exit 0
fi

發佈了27 篇原創文章 · 獲贊 3 · 訪問量 13萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章