Changeset 18702
- Timestamp:
- 01/04/17 22:41:35 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/Monitoring/CheckLogs.sh
r17615 r18702 6 6 7 7 source `dirname $0`/../Sourcefile.sh 8 printprocesslog "INFO starting $0 "8 printprocesslog "INFO starting $0 $1" 9 9 10 lasthour=`date +'%F %H' --date="-1hour"` 11 12 processlogfile=$processlogpath/process`date +%F --date="-1hour"`.log 13 14 if grep -E "^$lasthour.*WARN" $processlogfile >/dev/null 10 if ! [ "$1" = "day" ] && ! [ "$1" = "hour" ] 15 11 then 16 grep -E "^$lasthour.*WARN" $processlogfile | mail -s 'found warnings in '$processlogfile $erradrs 17 printprocesslog "INFO sent warnings to "$erradrs 12 #echo "wrong option "$1" (only min and nights valid)." 13 echo "wrong option "$1" (only day and hour valid)." 14 finish 18 15 fi 19 16 20 if grep -E "^$lasthour.*ERROR" $processlogfile >/dev/null 17 # check for connection problems or full disks every hour 18 if [ "$1" = "hour" ] 21 19 then 22 grep -E "^$lasthour.*ERROR" $processlogfile | mail -s 'found errors in '$processlogfile $erradrs 23 printprocesslog "INFO sent errors to "$erradrs 20 lastdate=`date +'%F %H' --date="-1hour"` 21 processlogfile=$processlogpath/process`date +%F --date="-1hour"`.log 22 23 if grep -E "^$lastdate.*DISK" $processlogfile >/dev/null 24 then 25 grep -E "^$lastdate.*DISK" $processlogfile | mail -s 'disk full ('$processlogfile')' $deladrs 26 printprocesslog "INFO sent full-disk info to "$deladrs 27 fi 28 29 if grep -E "^$lastdate.*CONNECTION" $processlogfile >/dev/null 30 then 31 grep -E "^$lastdate.*CONNECTION" $processlogfile | mail -s 'found connection problems found ('$processlogfile')' $erradrs 32 printprocesslog "INFO sent connection-problem info to "$erradrs 33 fi 24 34 fi 25 35 26 if grep -E "^$lasthour.*CONNECTION" $processlogfile >/dev/null 27 then 28 grep -E "^$lasthour.*CONNECTION" $processlogfile | mail -s 'found connection problems found ('$processlogfile')' $erradrs 29 printprocesslog "INFO sent connection-problem info to "$erradrs 36 # check for errors and warnings once a day 37 if [ "$1" = "day" ] 38 then 39 lastdate=`date +'%F ' --date="-1hour"` 40 processlogfile=$processlogpath/process`date +%F --date="-1hour"`.log 41 42 if grep -E "^$lastdate.*WARN" $processlogfile >/dev/null 43 then 44 grep -E "^$lastdate.*WARN" $processlogfile | mail -s 'found warnings in '$processlogfile $erradrs 45 printprocesslog "INFO sent warnings to "$erradrs 46 fi 47 48 if grep -E "^$lastdate.*ERROR" $processlogfile >/dev/null 49 then 50 grep -E "^$lastdate.*ERROR" $processlogfile | mail -s 'found errors in '$processlogfile $erradrs 51 printprocesslog "INFO sent errors to "$erradrs 52 fi 30 53 fi 31 54 32 if grep -E "^$lasthour.*DISK" $processlogfile >/dev/null 33 then 34 grep -E "^$lasthour.*DISK" $processlogfile | mail -s 'disk full ('$processlogfile')' $deladrs 35 printprocesslog "INFO sent full-disk info to "$deladrs 36 fi 55 printprocesslog "INFO finished $0 $1" 37 56 38 printprocesslog "INFO finished $0"39
Note:
See TracChangeset
for help on using the changeset viewer.