Changeset 18702


Ignore:
Timestamp:
01/04/17 22:41:35 (8 years ago)
Author:
Daniela Dorner
Message:
check for errors and warnings only once per day but for connection problems or full disk every hour
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/Monitoring/CheckLogs.sh

    r17615 r18702  
    66
    77source `dirname $0`/../Sourcefile.sh
    8 printprocesslog "INFO starting $0"
     8printprocesslog "INFO starting $0 $1"
    99
    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
     10if ! [ "$1" = "day" ] && ! [ "$1" = "hour" ]
    1511then
    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
    1815fi
    1916
    20 if grep -E "^$lasthour.*ERROR" $processlogfile >/dev/null
     17# check for connection problems or full disks every hour
     18if [ "$1" = "hour" ]
    2119then
    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
    2434fi
    2535
    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
     37if [ "$1" = "day" ]
     38then
     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
    3053fi
    3154
    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
     55printprocesslog "INFO finished $0 $1"
    3756
    38 printprocesslog "INFO finished $0"
    39 
Note: See TracChangeset for help on using the changeset viewer.