报警系统配置文件
Posted nfyx
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了报警系统配置文件相关的知识,希望对你有一定的参考价值。
1、报警系统主脚本文件
2、配制文件
3、负载大于10发送邮件:
#! /bin/bash
##Writen by aming##
load=`uptime |awk -F ‘average:‘ ‘{print $2}‘|cut -d‘,‘ -f1|sed ‘s/ //g‘ |cut -d. -f1`
if [ $load -gt 10 ] && [ $send -eq "1" ]
then
echo "$addr `date +%T` load is $load" >../log/load.tmp
/bin/bash ../mail/mail.sh [email protected] "$addr\\_load:$load" `cat ../log/load.tmp`
fi
echo "`date +%T` load is $load"
4、502错误:
#! /bin/bash
d=`date -d "-1 min" +%H:%M`
c_502=`grep :$d:??$log??|grep ‘ 502 ‘|wc -l`
if [ $c_502 -gt 10 ] && [ $send == 1 ]; then
echo "$addr $d 502 count is $c_502">../log/502.tmp
/bin/bash ../mail/mail.sh $addr\\_502 $c_502??../log/502.tmp
fi
echo "`date +%T` 502 $c_502"
5、disk
#! /bin/bash
##Writen by aming##
rm -f ../log/disk.tmp
for r in `df -h |awk -F ‘[ %]+‘ ‘{print $5}‘|grep -v Use`
do
if [ $r -gt 90 ] && [ $send -eq "1" ]
then
echo "$addr `date +%T` disk useage is $r" >>../log/disk.tmp
fi
if [ -f ../log/disk.tmp ]
then
df -h >> ../log/disk.tmp
/bin/bash ../mail/mail.sh $addr\\_disk $r ../log/disk.tmp
echo "`date +%T` disk useage is nook"
else
echo "`date +%T` disk useage is ok"
fi
以上是关于报警系统配置文件的主要内容,如果未能解决你的问题,请参考以下文章