summaryrefslogtreecommitdiff
path: root/puppet/modules/site_check_mk/files/agent/local_checks/mx/check_leap_mx.sh
blob: 2958d2ed40baf0cf35df50c6b112954bbd652b2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash


WARN=1
CRIT=5

# in minutes
MAXAGE=10

STATUS[0]='OK'
STATUS[1]='Warning'
STATUS[2]='Critical'
CHECKNAME='Leap_MX_Queue'

WATCHDIR='/var/mail/vmail/Maildir/new/'


total=`find $WATCHDIR -type f -mmin +$MAXAGE | wc -l`

if [ $total -lt $WARN ]
then
  exitcode=0
else
  if [ $total -le $CRIT ]
  then
    exitcode=1
  else
      exitcode=2
  fi
fi

echo "$exitcode $CHECKNAME stale_files=$total ${STATUS[exitcode]}: $total stale files (>=$MAXAGE min) in $WATCHDIR."