summaryrefslogtreecommitdiffstats
path: root/web/attachments/241185-check_mailq.pl.patch
blob: 906234b325dc6632acfe29f0d4be5e29f94adf78 (plain)
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
--- check_mailq.pl.orig	2006-07-05 15:45:57.000000000 +0200
+++ check_mailq.pl	2007-08-14 13:32:15.463385010 +0200
@@ -29,7 +29,7 @@
 use POSIX;
 use strict;
 use Getopt::Long;
-use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t
+use vars qw($opt_d $opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t
 					$opt_M $mailq $status $state $msg $msg_q $msg_p $opt_W $opt_C $mailq @lines
 					%srcdomains %dstdomains);
 use lib  utils.pm;
@@ -515,12 +515,17 @@
 		("V"   => \$opt_V, "version"	=> \$opt_V,
 		 "v"   => \$opt_v, "verbose"	=> \$opt_v,
 		 "h"   => \$opt_h, "help"		=> \$opt_h,
+		 "d:s" => \$opt_d, "configdir:s" => \$opt_d, 
 		 "M:s" => \$opt_M, "mailserver:s" => \$opt_M, # mailserver (default	sendmail)
 		 "w=i" => \$opt_w, "warning=i"  => \$opt_w,   # warning if above this number
 		 "c=i" => \$opt_c, "critical=i" => \$opt_c,	  # critical if above this number
 		 "t=i" => \$opt_t, "timeout=i"  => \$opt_t 
 		 );
 
+	if ($opt_d) {
+		$ENV{'MAIL_CONFIG'}=$opt_d;
+	}
+
 	if ($opt_V) {
 		print_revision($PROGNAME,'$Revision: 1.7 $ ');
 		exit $ERRORS{'OK'};
@@ -576,7 +581,7 @@
 }
 
 sub print_usage () {
-	print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose]\n";
+	print "Usage: $PROGNAME -d <configdir> -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose]\n";
 }
 
 sub print_help () {
@@ -587,6 +592,7 @@
 	print "\n";
 	print "   Checks the number of messages in the mail queue (supports multiple sendmail queues, qmail)\n";
 	print "   Feedback/patches to support non-sendmail mailqueue welcome\n\n";
+	print "-d (--configdir) = Use configdir for postfix command (MAIL_CONFIG)\n";
 	print "-w (--warning)   = Min. number of messages in queue to generate warning\n";
 	print "-c (--critical)  = Min. number of messages in queu to generate critical alert ( w < c )\n";
 	print "-W (--Warning)   = Min. number of messages for same domain in queue to generate warning\n";