/usr/share/munin/plugins/postfix_mailqueue is in munin-node 1.4.6-3ubuntu3.4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | #!/bin/sh
# -*- sh -*-
: << =cut
=head1 NAME
postfix_mailqueue - Plugin to monitor postfix mail spools
=head1 ABOUT
A guide to postfix mail queue manageent can be found at
L<http://www.postfix.org/QSHAPE_README.html#queues>
A summary:
=over 4
=item maildrop
Messages that have been submitted via the Postfix sendmail(1) command,
but not yet brought into the main Postfix queue by the pickup(8)
service.
=item hold
Messages placed in the "hold" queue stay there until the administrator
intervenes
=item incoming
Inbound mail from the network, or mail picked up by the local
pickup(8) daemon from the maildrop directory.
=item active
Messages that the queue manager has opened for delivery. Only a limited number
of messages is allowed to enter the active queue (leaky bucket strategy, for a
fixed delivery rate).
=item deferred
Mail that could not be delivered upon the first attempt. The queue manager
implements exponential backoff by doubling the time between delivery attempts.
=item corrupt
Unreadable or damaged queue files are moved here for inspection.
=back
=head1 CONFIGURATION
By default "postconf -h queue_directory" is used to determine the
spool directory. Is postconf is not available in the $PATH then
/var/spool/postfix is assumed. This can be overridden by the
"spooldir" environment variable like so:
[postfix_mailqueue]
env.spooldir /var/spool/postfix
=head1 AUTHOR
Unknown.
=head1 LICENSE
Unknown.
=head1 MAGIC MARKERS
=begin comment
These magic markers are used by munin-node-configure when installing
munin-node.
=end comment
#%# family=auto
#%# capabilities=autoconf
=cut
# atempt to get spooldir via postconf, but environment overrides.
# Remember that postconf is not available unless postfix is.
POSTCONFSPOOL="$(postconf -h queue_directory 2>/dev/null || echo /var/spool/postfix)"
SPOOLDIR=${spooldir:-$POSTCONFSPOOL}
. $MUNIN_LIBDIR/plugins/plugin.sh
case $1 in
autoconf|detect)
if [ -d $SPOOLDIR ] ; then
echo yes
exit 0
else
echo "no (spooldir not found)"
exit 0
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
for field in active deferred maildrop incoming corrupt hold; do
print_warning $field
print_critical $field
done
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
|