Chkeximqueue
From brokenpoet.org wiki
The job of this script is to check the mail queue count and, if it is over a certain threshold, mail someone to let them know.
There are two thresholds - mainly because I thought people might want to get texted at all hours if it gets to high.
There are three options for the type of mail. One runs exiwhat and shows you what exim is currently down, the next runs a summary of the queue and the third simply sends a subject line and a blank message (more appropriate for a text to a cell phone like ##########@vtext.com).
This script should be run as a cron job maybe every 15 minutes. The mail queue threshold and email address need to be modified. Everything else is self-explanatory.
wget http://scripts.brokenpoet.org/chkeximqueue
#!/bin/bash
# created by benjamin cathey 2008.03.22 9:11
a=$(/usr/sbin/exim -bpc)
# Please modify the two thresholds below - The first is the low
# value to get emailed at and the second is the CRITICAL value.
# Set these to whatever fits your needs.
if [ $a > 500 ]; then
if [ $a > 1000 ]; then
# This is the high priority area
#
# If sending to an actual mail account and not a phone uncomment
# the following line and comment the other mail directive -
#
# Alternately you can use both - one with just subject and one with
# a full body
#
# exiwhat |mail -s "Exim Queue is $a - Hurry!!!" user@domain.com
# or
# exim -bp|exiqsumm -c |mail -s "Exim Queue is $a - Hurry!!!" user@domain.com
#
echo "" |mail -s "Exim Queue is $a - Hurry!!!" user@domain.com
else
# This is the low priority area.
# The same goes for this here
#
# exiwhat |mail -s "Exim Queue is $a - Watch It" user@domain.com
# or
# exim -bp|exiqsumm -c |mail -s "Exim Queue is $a - Watch It" user@domain.com
#
echo "" |mail -s "Exim Queue is $a - Watch It" user@domain.com
fi
fi
