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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
#!/bin/sh
#
# Plugin to monitor postfix mail spools
#
# Contributed by Nicolai Langfeldt
#
# $Log$
# Revision 1.4 2004/05/20 19:02:36 jimmyo
# Set categories on a bunch of plugins
#
# Revision 1.3 2004/05/14 21:16:46 jimmyo
# "Upped" som plugins from contrib/manual to auto.
#
# Revision 1.2 2004/05/09 21:11:15 jimmyo
# New plugin (pm3users) and a bunch of patches from Jacques Caruso.
#
# Revision 1.1 2004/01/02 18:50:00 jimmyo
# Renamed occurrances of lrrd -> munin
#
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
# Import of LRRD CVS tree after renaming to Munin
#
# Revision 1.2 2003/11/26 14:55:52 jimmyo
# Added total summaries
#
# Revision 1.1 2003/11/26 09:10:28 jimmyo
# Plugin contribution by Nicolai Langfeldt
#
#
#%# family=auto
#%# capabilities=autoconf
# Can be set via environment, but default is /var/spool/postfix
SPOOLDIR=${spooldir:-/var/spool/postfix}
# Postfix mqueue management: http://www.postfix.cs.uu.nl/queuing.html
# maildrop: Localy posted mail
# incoming: Processed local mail and received from network
# active: Mails being delivered (should be small)
# deferred: Stuck mails (that will be retried later)
# corrupt: Messages found to not be in correct format (shold be 0)
# hold: Recent addition, messages put on hold indefinitly - delete of free
case $1 in
autoconf|detect)
if [ -d $SPOOLDIR/ ] ; then
echo yes
exit 0
else
echo "no (spooldir not found)"
exit 1
fi;;
config)
cat <<'EOF'
graph_title Postfix Mailqueue
graph_vlabel Mails in queue
graph_category postfix
graph_total Total
active.label active
deferred.label deferred
maildrop.label maildrop
incoming.label incoming
corrupt.label corrupt
hold.label held
EOF
exit 0;;
esac
cd $SPOOLDIR >/dev/null 2>/dev/null || {
echo "# Cannot cd to $SPOOLDIR"
exit 1
}
cat <<EOF
deferred.value `(test -d deferred && find deferred -type f ) | wc -l`
active.value `(test -d active && find active -type f ) | wc -l`
maildrop.value `(test -d maildrop && find maildrop -type f ) | wc -l`
incoming.value `(test -d incoming && find incoming -type f ) | wc -l`
corrupt.value `(test -d corrupt && find corrupt -type f ) | wc -l`
hold.value `( test -d hold && find hold -type f ) | wc -l`
EOF
|