--- /dev/null
+#!/bin/sh
+# -*- sh -*-
+
+: << =cut
+
+=head1 NAME
+
+nullmailer_mailqueue - Plugin to graph the nullmailer queue size
+
+=head1 CONFIGURATION
+
+This plugin uses the following configuration variables
+
+ [nullmailer_mailqueue]
+ env.queuecmd - mailq command to execute
+
+=head2 DEFAULT CONFIGURATION
+
+The default configuration is
+
+ [nullmailer_mailqueue]
+ env.mtaqueue /usr/bin/mailq
+
+=head1 AUTHOR
+
+Sven Hoexter
+
+=head1 LICENSE
+
+GPLv2
+
+=head1 MAGIC MARKERS
+
+ #%# family=auto
+ #%# capabilities=autoconf
+
+=cut
+QUEUECMD=${queuecmd:-/usr/bin/mailq}
+
+if [ "$1" = "autoconf" ]; then
+ if [ -x "$QUEUECMD" ] ; then
+ echo yes
+ exit 0
+ else
+ echo "no (queue command ${QUEUECMD} not found)"
+ exit 0
+ fi
+fi
+
+if [ "$1" = "config" ]; then
+
+ echo 'graph_title nullmailer queued mails'
+ echo 'graph_order mails'
+ echo 'graph_vlabel mails in queue'
+ echo 'graph_category nullmailer'
+ echo 'mails.label mails'
+ exit 0
+fi
+
+mtamails=$(${QUEUECMD} | grep -Ec '[0-9]{4}')
+echo "mails.value ${mtamails}"