#!/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
#####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