add mail check
This commit is contained in:
25
check_mail_eklig.sh
Executable file
25
check_mail_eklig.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
MAILDIR=/home/mailtest/mail
|
||||
PERSISTENCE_FILE=/tmp/mailnum
|
||||
|
||||
cur_num=$(find $MAILDIR -type f | wc -l)
|
||||
prev_num=$(cat $PERSISTENCE_FILE)
|
||||
|
||||
EXITCODE=3
|
||||
STATUS=UNKNOWN
|
||||
|
||||
if [ $cur_num -gt $prev_num ]; then
|
||||
EXITCODE=0
|
||||
STATUS="OK: increasing"
|
||||
else
|
||||
EXITCODE=1
|
||||
STATUS="CRITICAL: not increasing"
|
||||
fi
|
||||
|
||||
echo $cur_num > $PERSISTENCE_FILE
|
||||
|
||||
performance="mails:$cur_num"
|
||||
|
||||
print "$STATUS | $performance"
|
||||
exit $EXITCODE
|
||||
|
||||
Reference in New Issue
Block a user