File: sendmail_mailqueue.in

package info (click to toggle)
munin 2.0.6-4%2Bdeb7u2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 5,944 kB
  • sloc: perl: 11,577; sh: 2,939; java: 1,880; makefile: 726; python: 272
file content (70 lines) | stat: -rw-r--r-- 1,396 bytes parent folder | download | duplicates (6)
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
#!@@GOODSH@@
# -*- sh -*-

: << =cut

=head1 NAME

sendmail_mailqueue - Plugin to graph the sendmail queue size

=head1 CONFIGURATION

This plugin uses the following configuration variables

 [sendmail_mailqueue]
  env.mspqueue - MSQ queue directory
  env.mtaqueue - MTA queue directory

=head2 DEFAULT CONFIGURATION

The default configuration is

 [sendmail_mailqueue]
  env.mspqueue /var/spool/mqueue-client
  env.mtaqueue /var/spool/mqueue

=head1 AUTHOR

Unknown author

=head1 LICENSE

GPLv2

=head1 MAGIC MARKERS

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

=cut

MSP_QUEUE=/var/spool/mqueue-client
MTA_QUEUE=/var/spool/mqueue
if [ "$mspqueue"  ]; then MSP_QUEUE=$mspqueue ; fi
if [ "$mtaqueue"  ]; then MTA_QUEUE=$mtaqueue ; fi

if [ "$1" = "autoconf" ]; then
	if [ -d ${MSP_QUEUE} -a -d ${MTA_QUEUE} ] ; then
		echo yes
		exit 0
	else
		echo no
		exit 0
	fi
fi

if [ "$1" = "config" ]; then

	echo 'graph_title Sendmail queued mails'
	echo 'graph_order mails'
	echo 'graph_vlabel mails in queue'
	echo 'graph_category sendmail'
	echo 'mails.label mails'
	exit 0
fi

# Append /. to directory to force following symlinks at the start
# point.
mspmails=$(find ${MSP_QUEUE}/. -type f -name '[qQ]*' 2>/dev/null | fgrep -v '.hoststat' | wc -l)
mtamails=$(find ${MTA_QUEUE}/. -type f -name '[qQ]*' 2>/dev/null | fgrep -v '.hoststat' | wc -l)
echo "mails.value `expr ${mspmails} + ${mtamails}`"