Innode使用率监控报警*
Innode使用率监控报警* #!/bin/bash#mail:zhuying.jz.137@163.com
usage()
{
cat <<EOF
Usage:
Show the inode use percentage:'df -i'
EOF
}
if [ $# -gt 0 ];then
usage
fi
############################################################
#############If IUse% gt 80%,mail to admin##################
############################################################
unset A
tmpfile=./aaa
date > $tmpfile
echo "******************************************************************" >> $tmpfile
df -iPh|awk 'NR==1{print $0}' >> $tmpfile
df -Pih|awk '{if ($5~/8.%/ || $5~/9.%/ || $5~/100%/) print}' >> $tmpfile
A=`df -Pih|awk '{if ($5~/8.%/ || $5~/9.%/ || $5~/100%/) print}'`
if [ ! -z "$A" ];then
echo "##########################################"
echo "Alert:The innode usageage is above 80%!!!"
echo "##########################################"
mail -s "Alert:IUse% is out of 80%!!!" oracle < $tmpfile
echo "******************************************************************" >> $tmpfile
firm$tmpfile
小节:
以上是监控innode使用率的,大于80%就会邮件报警,当然你也可以使用通过snmpget OID获取系统数据,用cacti进行绘图~
例:snmpget -c 99billsnmp -v 2c 192.168.10.80 .1.3.6.1.4.1.2021.9.1.10.1
需要注意的就是if [ ! -z "$A" ];then【当然还可以使用if [ -n "$A" ];then】判断的时候,一定不要忘了加上“ ”
谢谢分享 本帖最后由 blueswxs 于 2012-02-19 15:23 编辑
代码条理不错。呵呵。
页:
[1]