Repository
Munin (2.0)
Last change
2020-09-16
Family
auto
Capabilities
Language
Shell
Authors

courier_mta_mailqueue

Name

courier_mta_mailqueue - Plugin to monitor courier-mta mail spool

Configuration

Configuration variables:

spooldir - Where to find mails in queue

The default configuration is:

[courier_mta_mailqueue]
 env.spooldir /var/lib/courier/msgq/

Magic Markers

#%# family=auto
#%# capabilities=autoconf

Bugs

None known

Author

Rune Nordbøe Skillingstad runesk@linpro.no

License

Unknown

#!@@GOODSH@@
# -*- sh -*-

: << =cut

=head1 NAME

courier_mta_mailqueue - Plugin to monitor courier-mta mail spool

=head1 CONFIGURATION

Configuration variables:

 spooldir - Where to find mails in queue

The default configuration is:

 [courier_mta_mailqueue]
  env.spooldir /var/lib/courier/msgq/

=head1 MAGIC MARKERS

 #%# family=auto
 #%# capabilities=autoconf

=head1 BUGS

None known

=head1 AUTHOR

Rune Nordbøe Skillingstad <runesk@linpro.no>

=head1 LICENSE

Unknown

=cut

# Can be set via environment, but default is /var/lib/courier/msgq/
SPOOLDIR=${spooldir:-/var/lib/courier/msgq/}

case $1 in
    autoconf|detect)
	if [ -d "$SPOOLDIR/" ] && [ -r "$SPOOLDIR/" ] ; then
	    echo yes
	    exit 0
        else
	    echo "no (spooldir not found)"
	    exit 0
        fi;;
    config)
	cat <<'EOF'
graph_title Courier MTA mailqueue
graph_vlabel Mails in queue
graph_args --base 1000 -l 0
mails.label mails
mails.draw AREA
EOF
	exit 0;;
esac

cd "$SPOOLDIR" >/dev/null 2>/dev/null || {
     echo "# Cannot cd to $SPOOLDIR"
     exit 1
}

cat <<EOF
mails.value $(find . -type f | wc -l | sed 's/ *//')
EOF