source: trunk/DataCheck/Monitoring/CheckLogs.sh@ 18066

Last change on this file since 18066 was 17615, checked in by Daniela Dorner, 11 years ago
added sending email in case there were warnings about full disks
  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/bin/bash
2#
3# This script checks, if there are WARNs or ERRORs in the processlog of
4# the last night and sends them to the emailadresse(s) in $erradr
5#
6
7source `dirname $0`/../Sourcefile.sh
8printprocesslog "INFO starting $0"
9
10lasthour=`date +'%F %H' --date="-1hour"`
11
12processlogfile=$processlogpath/process`date +%F --date="-1hour"`.log
13
14if grep -E "^$lasthour.*WARN" $processlogfile >/dev/null
15then
16 grep -E "^$lasthour.*WARN" $processlogfile | mail -s 'found warnings in '$processlogfile $erradrs
17 printprocesslog "INFO sent warnings to "$erradrs
18fi
19
20if grep -E "^$lasthour.*ERROR" $processlogfile >/dev/null
21then
22 grep -E "^$lasthour.*ERROR" $processlogfile | mail -s 'found errors in '$processlogfile $erradrs
23 printprocesslog "INFO sent errors to "$erradrs
24fi
25
26if grep -E "^$lasthour.*CONNECTION" $processlogfile >/dev/null
27then
28 grep -E "^$lasthour.*CONNECTION" $processlogfile | mail -s 'found connection problems found ('$processlogfile')' $erradrs
29 printprocesslog "INFO sent connection-problem info to "$erradrs
30fi
31
32if grep -E "^$lasthour.*DISK" $processlogfile >/dev/null
33then
34 grep -E "^$lasthour.*DISK" $processlogfile | mail -s 'disk full ('$processlogfile')' $deladrs
35 printprocesslog "INFO sent full-disk info to "$deladrs
36fi
37
38printprocesslog "INFO finished $0"
39
Note: See TracBrowser for help on using the repository browser.