Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / mail / nullmailer_queue @ 09b88141

Historique | Voir | Annoter | Télécharger (2,11 ko)

1
#!/bin/sh
2

    
3
: <<=cut
4

    
5
=head1 NAME
6

    
7
nullmailer_queue - monitor for nullmailer's send queue.
8

    
9
=head1 APPLICABLE SYSTEMS
10

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

    
13
=head1 CONFIGURATION
14

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

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

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

    
24
Example:
25

    
26
  [nullmailer_queue]
27
  user nullmail
28
  env.queuedir /var/spool/nullmailer/queue
29
  env.errordir /var/spool/nullmailer/failed
30
  env.queue_warning 10
31

    
32
=head1 INTERPRETATION
33

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

    
38
=head1 MAGIC MARKERS
39

    
40
  #%# family=auto
41
  #%# capabilities=autoconf
42

    
43
=head1 VERSION
44

    
45
  1.0.0
46

    
47
=head1 AUTHOR
48

    
49
Bert Peters <bert@bertptrs.nl>
50

    
51
=head1 LICENSE
52

    
53
GPLv2
54

    
55
=cut
56

    
57
. "$MUNIN_LIBDIR/plugins/plugin.sh"
58

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

    
62
failed_warning=${failed_warning:-0:0}
63

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

    
73
	config)
74
		cat <<-EOF
75
graph_args -l 0
76
graph_title Nullmailer queue
77
graph_vlabel emails
78
graph_total total
79
graph_category mail
80

    
81
queue.label queued
82
queue.draw AREASTACK
83
queue.info Number of emails currently in the queue
84

    
85
failed.label failed
86
failed.draw AREASTACK
87
failed.info Number of emails that have permanently failed to send
88
EOF
89
		print_warning queue
90
		print_critical queue
91
		print_warning failed
92
		print_critical failed
93
		;;
94

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