*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
fi

rm  $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】判断的时候,一定不要忘了加上“ ”

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值