Repository
Munin (contrib)
Last change
2020-10-24
Graph Categories
Family
auto
Capabilities
Keywords
Language
Shell
License
GPL-2.0-only
Authors

nullmailer_queue

Name

nullmailer_queue - monitor for nullmailer’s send queue.

Applicable Systems

This plugin is applicable to any system running the nullmailer MTA.

Configuration

This plugin needs to be able to read the nullmailer queue, so it will need to run as that user or root.

Additionally, the nullmailer queue directory may vary; in that case you can specify it with the “queuedir” and “errordir” environment variables.

To add extra warning or critical thresholds set queue_warning, failed_critical etc.

Example:

[nullmailer_queue]
user nullmail
env.queuedir /var/spool/nullmailer/queue
env.errordir /var/spool/nullmailer/failed
env.queue_warning 10

Interpretation

This plugin will draw a stack of 2: the number of emails in the queue, and the number of emails that have permanently failed sending. The latter has a warning attached by default, since those should never happen.

Magic Markers

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

Version

1.0.0

Author

Bert Peters bert@bertptrs.nl

License

GPLv2

#!/bin/sh

: <<=cut

=head1 NAME

nullmailer_queue - monitor for nullmailer's send queue.

=head1 APPLICABLE SYSTEMS

This plugin is applicable to any system running the nullmailer MTA.

=head1 CONFIGURATION

This plugin needs to be able to read the nullmailer queue, so it
will need to run as that user or root.

Additionally, the nullmailer queue directory may vary; in that case you
can specify it with the "queuedir" and "errordir" environment variables.

To add extra warning or critical thresholds set queue_warning,
failed_critical etc.

Example:

  [nullmailer_queue]
  user nullmail
  env.queuedir /var/spool/nullmailer/queue
  env.errordir /var/spool/nullmailer/failed
  env.queue_warning 10

=head1 INTERPRETATION

This plugin will draw a stack of 2: the number of emails in the queue, and
the number of emails that have permanently failed sending. The latter has
a warning attached by default, since those should never happen.

=head1 MAGIC MARKERS

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

=head1 VERSION

  1.0.0

=head1 AUTHOR

Bert Peters <bert@bertptrs.nl>

=head1 LICENSE

GPLv2

=cut

. "$MUNIN_LIBDIR/plugins/plugin.sh"

queuedir=${queuedir:-/var/spool/nullmailer/queue}
errordir=${errordir:-/var/spool/nullmailer/failed}

failed_warning=${failed_warning:-0:0}

case $1 in
	autoconf)
		if command -v nullmailer-queue >/dev/null 2>/dev/null; then
			[ -r "$queuedir" ] && echo yes || echo "no (queue dir not readable)"
		else
			echo "no (nullmailer not installed)"
		fi
		;;

	config)
		cat <<-EOF
graph_args -l 0
graph_title Nullmailer queue
graph_vlabel emails
graph_total total
graph_category mail

queue.label queued
queue.draw AREASTACK
queue.info Number of emails currently in the queue

failed.label failed
failed.draw AREASTACK
failed.info Number of emails that have permanently failed to send
EOF
		print_warning queue
		print_critical queue
		print_warning failed
		print_critical failed
		;;

	*)
		echo "queue.value $(find "$queuedir" -type f | wc -l)"
		# Failed does not exist until there has been a failure, so mute the "file not found"
		echo "failed.value $(find "$errordir" -type f 2> /dev/null | wc -l)"
		;;
esac