-
-
Save heartshare/7bdeebfab74ed436e72c163aadbb3004 to your computer and use it in GitHub Desktop.
alert based in mail queue size for postfix and plesk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
MAIL_BIN=`command -v mail` | |
QUEUE_SIZE=`/usr/sbin/postqueue -p | tail -n1 | awk '{print $5}'` | |
QUEUE_SUMMARY=`/usr/sbin/qshape -s deferred | head` | |
MAILTO="[email protected]" | |
LIMIT=100 | |
function send_notification_mail() { | |
echo $QUEUE_SUMMARY | $MAIL_BIN -s "WARNING: mail queue critical on $HOSTNAME" $MAILTO | |
} | |
if [ "$QUEUE_SIZE" -gt "$LIMIT" ]; then | |
send_notification_mail | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment