summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSubhendu Ghosh <sghosh@users.sourceforge.net>2003-04-13 04:23:56 +0000
committerSubhendu Ghosh <sghosh@users.sourceforge.net>2003-04-13 04:23:56 +0000
commit664be83730ff97368e8bfcf5e1fc4db2435d2c3a (patch)
tree882de999eb178892cde0e5617119597301a28fc0
parent12536a8506afce67a19248fd51462ebf2b80fd72 (diff)
downloadmonitoring-plugins-664be83730ff97368e8bfcf5e1fc4db2435d2c3a.tar.gz
Added sendmail multi-queue support (Canau), merged qmail support (Schmid)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@490 f882894a-f735-0410-b71e-b25c423dba1c
-rwxr-xr-xplugins-scripts/check_mailq.pl412
1 files changed, 362 insertions, 50 deletions
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl
index 901209b8..23bc521f 100755
--- a/plugins-scripts/check_mailq.pl
+++ b/plugins-scripts/check_mailq.pl
@@ -4,6 +4,8 @@
4# transmittal. 4# transmittal.
5# 5#
6# Initial version support sendmail's mailq command 6# Initial version support sendmail's mailq command
7# Support for mutiple sendmail queues (Carlos Canau)
8# Support for qmail (Benjamin Schmid)
7 9
8# License Information: 10# License Information:
9# This program is free software; you can redistribute it and/or modify 11# This program is free software; you can redistribute it and/or modify
@@ -25,12 +27,12 @@
25use POSIX; 27use POSIX;
26use strict; 28use strict;
27use Getopt::Long; 29use Getopt::Long;
28use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t $status $state $msg $msg_q ); 30use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t
31 $opt_M $mailq $status $state $msg $msg_q $msg_p $opt_W $opt_C $mailq @lines
32 %srcdomains %dstdomains);
29use lib utils.pm; 33use lib utils.pm;
30use utils qw(%ERRORS &print_revision &support &usage ); 34use utils qw(%ERRORS &print_revision &support &usage );
31 35
32#my $MAILQ = "/usr/bin/mailq"; # need to migrate support to utils.pm and autoconf
33
34 36
35sub print_help (); 37sub print_help ();
36sub print_usage (); 38sub print_usage ();
@@ -40,6 +42,10 @@ $ENV{'PATH'}='';
40$ENV{'BASH_ENV'}=''; 42$ENV{'BASH_ENV'}='';
41$ENV{'ENV'}=''; 43$ENV{'ENV'}='';
42$PROGNAME = "check_mailq"; 44$PROGNAME = "check_mailq";
45$mailq = 'sendmail'; # default
46$msg_q = 0 ;
47$msg_p = 0 ;
48$state = $ERRORS{'UNKNOWN'};
43 49
44Getopt::Long::Configure('bundling'); 50Getopt::Long::Configure('bundling');
45$status = process_arguments(); 51$status = process_arguments();
@@ -54,60 +60,329 @@ $SIG{'ALRM'} = sub {
54}; 60};
55alarm($opt_t); 61alarm($opt_t);
56 62
57## open mailq 63# switch based on MTA
58if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { 64
59 if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { 65if ($mailq eq "sendmail") {
60 print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; 66
67 ## open mailq
68 if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
69 if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) {
70 print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
71 exit $ERRORS{'UNKNOWN'};
72 }
73 }elsif( defined $utils::PATH_TO_MAILQ){
74 unless (-x $utils::PATH_TO_MAILQ) {
75 print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n";
76 exit $ERRORS{'UNKNOWN'};
77 }
78 } else {
79 print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n";
61 exit $ERRORS{'UNKNOWN'}; 80 exit $ERRORS{'UNKNOWN'};
62 } 81 }
63}else{ 82# single queue empty
64 print "ERROR: Could not find mailq executable!\n"; 83##/var/spool/mqueue is empty
65 exit $ERRORS{'UNKNOWN'}; 84# single queue: 1
66} 85## /var/spool/mqueue (1 request)
86##----Q-ID---- --Size-- -----Q-Time----- ------------Sender/Recipient------------
87##h32E30p01763 2782 Wed Apr 2 15:03 <silvaATkpnqwest.pt>
88## 8BITMIME
89## <silvaATeunet.pt>
67 90
68# only first line is relevant in this iteration. 91# multi queue empty
69while (<MAILQ>) { 92##/var/spool/mqueue/q0/df is empty
70 if (/mqueue/) { 93##/var/spool/mqueue/q1/df is empty
71 print "$utils::PATH_TO_MAILQ = $_ "if $verbose ; 94##/var/spool/mqueue/q2/df is empty
72 if (/empty/ ) { 95##/var/spool/mqueue/q3/df is empty
73 $msg = "OK: mailq is empty"; 96##/var/spool/mqueue/q4/df is empty
74 $msg_q = 0; 97##/var/spool/mqueue/q5/df is empty
75 $state = $ERRORS{'OK'}; 98##/var/spool/mqueue/q6/df is empty
76 }elsif ( /(\d+)/ ) { 99##/var/spool/mqueue/q7/df is empty
77 $msg_q = $1 ; 100##/var/spool/mqueue/q8/df is empty
101##/var/spool/mqueue/q9/df is empty
102##/var/spool/mqueue/qA/df is empty
103##/var/spool/mqueue/qB/df is empty
104##/var/spool/mqueue/qC/df is empty
105##/var/spool/mqueue/qD/df is empty
106##/var/spool/mqueue/qE/df is empty
107##/var/spool/mqueue/qF/df is empty
108## Total Requests: 0
109# multi queue: 1
110##/var/spool/mqueue/q0/df is empty
111##/var/spool/mqueue/q1/df is empty
112##/var/spool/mqueue/q2/df is empty
113## /var/spool/mqueue/q3/df (1 request)
114##----Q-ID---- --Size-- -----Q-Time----- ------------Sender/Recipient------------
115##h32De2f23534* 48 Wed Apr 2 14:40 nocol
116## nouserATEUnet.pt
117## canau
118##/var/spool/mqueue/q4/df is empty
119##/var/spool/mqueue/q5/df is empty
120##/var/spool/mqueue/q6/df is empty
121##/var/spool/mqueue/q7/df is empty
122##/var/spool/mqueue/q8/df is empty
123##/var/spool/mqueue/q9/df is empty
124##/var/spool/mqueue/qA/df is empty
125##/var/spool/mqueue/qB/df is empty
126##/var/spool/mqueue/qC/df is empty
127##/var/spool/mqueue/qD/df is empty
128##/var/spool/mqueue/qE/df is empty
129##/var/spool/mqueue/qF/df is empty
130## Total Requests: 1
78 131
79 print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose; 132
80 133 while (<MAILQ>) {
81 if ($msg_q < $opt_w) { 134
82 $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)"; 135 # match email addr on queue listing
83 $state = $ERRORS{'OK'}; 136 if ( (/<.*@.*\.(\w+\.\w+)>/) || (/<.*@(\w+\.\w+)>/) ) {
84 }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) { 137 my $domain = $1;
85 $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)"; 138 if (/^\w+/) {
86 $state = $ERRORS{'WARNING'}; 139 print "$utils::PATH_TO_MAILQ = srcdomain = $domain \n" if $verbose ;
87 }else { 140 $srcdomains{$domain} ++;
88 $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
89 $state = $ERRORS{'CRITICAL'};
90 } 141 }
91 142 next;
143 }
144
145 #
146 # ...
147 # sendmail considers a message with more than one destiny, say N, to the same MX
148 # to have N messages in queue.
149 # we will only consider one in this code
150 if (( /\s\(reply:\sread\serror\sfrom\s.*\.(\w+\.\w+)\.$/ ) || ( /\s\(reply:\sread\serror\sfrom\s(\w+\.\w+)\.$/ ) ||
151 ( /\s\(timeout\swriting\smessage\sto\s.*\.(\w+\.\w+)\.:/ ) || ( /\s\(timeout\swriting\smessage\sto\s(\w+\.\w+)\.:/ ) ||
152 ( /\s\(host\smap:\slookup\s\(.*\.(\w+\.\w+)\):/ ) || ( /\s\(host\smap:\slookup\s\((\w+\.\w+)\):/ ) ||
153 ( /\s\(Deferred:\s.*\s.*\.(\w+\.\w+)\.\)/ ) || ( /\s\(Deferred:\s.*\s(\w+\.\w+)\.\)/ ) ) {
154
155 print "$utils::PATH_TO_MAILQ = dstdomain = $1 \n" if $verbose ;
156 $dstdomains{$1} ++;
157 }
158
159 if (/\s+\(I\/O\serror\)/) {
160 print "$utils::PATH_TO_MAILQ = dstdomain = UNKNOWN \n" if $verbose ;
161 $dstdomains{'UNKNOWN'} ++;
92 } 162 }
93 163
94 last; 164 # Finally look at the overall queue length
165 #
166 if (/mqueue/) {
167 print "$utils::PATH_TO_MAILQ = $_ "if $verbose ;
168 if (/ \((\d+) request/) {
169 #
170 # single queue: first line
171 # multi queue: one for each queue. overwrite on multi queue below
172 $msg_q = $1 ;
173 }
174 } elsif (/^\s+Total\sRequests:\s(\d+)$/) {
175 print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ;
176 #
177 # multi queue: last line
178 $msg_q = $1 ;
179 }
180
95 } 181 }
96 182
97}
98 183
99close (MAILQ); 184 ## close mailq
100# declare an error if we also get a non-zero return code from mailq 185
101# unless already set to critical 186 close (MAILQ);
102if ( $? ) { 187 # declare an error if we also get a non-zero return code from mailq
103 print "stderr = $? : $! \n" if $verbose; 188 # unless already set to critical
104 $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"UNKNOWN"} ; 189 if ( $? ) {
105 print "MAILQ error: $!\n" if $verbose; 190 $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ;
106} 191 print "STDERR $?: $!\n" if $verbose;
107## close mailq 192 $msg = "$state: (stderr)\n";
193 }
194
195 ## shut off the alarm
196 alarm(0);
197
198
199
200 ## now check the queue length(s)
201
202 if ($msg_q == 0) {
203 $msg = "OK: mailq is empty";
204 $state = $ERRORS{'OK'};
205 } else {
206 print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose;
207
208 # overall queue length
209 if ($msg_q < $opt_w) {
210 $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
211 $state = $ERRORS{'OK'};
212 }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) {
213 $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
214 $state = $ERRORS{'WARNING'};
215 }else {
216 $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
217 $state = $ERRORS{'CRITICAL'};
218 }
219
220 # check for domain specific queue lengths if requested
221 if (defined $opt_W) {
222
223 # Apply threshold to queue lengths FROM domain
224 my @srckeys = sort { $srcdomains{$b} <=> $srcdomains{$a} } keys %srcdomains;
225 my $srcmaxkey = $srckeys[0];
226 print "src max is $srcmaxkey with $srcdomains{$srcmaxkey} messages\n" if $verbose;
227
228 if ($srcdomains{$srcmaxkey} >= $opt_W && $srcdomains{$srcmaxkey} < $opt_C) {
229 if ($state == $ERRORS{'OK'}) {
230 $msg = "WARNING: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)";
231 $state = $ERRORS{'WARNING'};
232 } elsif (($state == $ERRORS{'WARNING'}) || ($state == $ERRORS{'CRITICAL'})){
233 $msg .= " -and- $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)";
234 } else {
235 $msg = "WARNING: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)";
236 $state = $ERRORS{'WARNING'};
237 }
238 } elsif ($srcdomains{$srcmaxkey} >= $opt_C) {
239 if ($state == $ERRORS{'OK'}) {
240 $msg = "CRITICAL: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold C = $opt_C)";
241 $state = $ERRORS{'CRITICAL'};
242 } elsif ($state == $ERRORS{'WARNING'}) {
243 $msg = "CRITICAL: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold C = $opt_C) -and- " . $msg;
244 $msg =~ s/WARNING: //;
245 } elsif ($state == $ERRORS{'CRITICAL'}) {
246 $msg .= " -and- $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)";
247 } else {
248 $msg = "CRITICAL: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)";
249 $state = $ERRORS{'CRITICAL'};
250 }
251 } else {
252 if ($srcdomains{$srcmaxkey} > 0) {
253 $msg .= " $srcdomains{$srcmaxkey} msgs. FROM $srcmaxkey is below threshold ($opt_W/$opt_C)";
254 }
255 }
256
257 # Apply threshold to queue lengths TO domain
258 my @dstkeys = sort { $dstdomains{$b} <=> $dstdomains{$a} } keys %dstdomains;
259 my $dstmaxkey = $dstkeys[0];
260 print "dst max is $dstmaxkey with $dstdomains{$dstmaxkey} messages\n" if $verbose;
261
262 if ($dstdomains{$dstmaxkey} >= $opt_W && $dstdomains{$dstmaxkey} < $opt_C) {
263 if ($state == $ERRORS{'OK'}) {
264 $msg = "WARNING: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)";
265 $state = $ERRORS{'WARNING'};
266 } elsif (($state == $ERRORS{'WARNING'}) || ($state == $ERRORS{'CRITICAL'})){
267 $msg .= " -and- $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)";
268 } else {
269 $msg = "WARNING: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)";
270 $state = $ERRORS{'WARNING'};
271 }
272 } elsif ($dstdomains{$dstmaxkey} >= $opt_C) {
273 if ($state == $ERRORS{'OK'}) {
274 $msg = "CRITICAL: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold C = $opt_C)";
275 $state = $ERRORS{'CRITICAL'};
276 } elsif ($state == $ERRORS{'WARNING'}) {
277 $msg = "CRITICAL: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold C = $opt_C) -and- " . $msg;
278 $msg =~ s/WARNING: //;
279 } elsif ($state == $ERRORS{'CRITICAL'}) {
280 $msg .= " -and- $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)";
281 } else {
282 $msg = "CRITICAL: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)";
283 $state = $ERRORS{'CRITICAL'};
284 }
285 } else {
286 if ($dstdomains{$dstmaxkey} > 0) {
287 $msg .= " $dstdomains{$dstmaxkey} msgs. TO $dstmaxkey is below threshold ($opt_W/$opt_C)";
288 }
289 }
290
291 } # End of queue length thresholds
292
293 }
294
295} # end of ($mailq eq "sendmail")
296elsif ( $mailq eq "qmail" ) {
297
298 # open qmail-qstat
299 if ( defined $utils::PATH_TO_QMAIL_QSTAT && -x $utils::PATH_TO_QMAIL_QSTAT ) {
300 if (! open (MAILQ, "$utils::PATH_TO_QMAIL_QSTAT | " ) ) {
301 print "ERROR: could not open $utils::PATH_TO_QMAIL_QSTAT \n";
302 exit $ERRORS{'UNKNOWN'};
303 }
304 }elsif( defined $utils::PATH_TO_QMAIL_QSTAT){
305 unless (-x $utils::PATH_TO_QMAIL_QSTAT) {
306 print "ERROR: $utils::PATH_TO_QMAIL_QSTAT is not executable by (uid $>:gid($)))\n";
307 exit $ERRORS{'UNKNOWN'};
308 }
309 } else {
310 print "ERROR: \$utils::PATH_TO_QMAIL_QSTAT is not defined\n";
311 exit $ERRORS{'UNKNOWN'};
312 }
313
314 @lines = <MAILQ>;
315
316 # close qmail-qstat
317 close MAILQ;
318 # declare an error if we also get a non-zero return code from mailq
319 # unless already set to critical
320 if ( $? ) {
321 $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ;
322 print "STDERR $?: $!\n" if $verbose;
323 $msg = "$state: (stderr)\n";
324 }
325
326 ## shut off the alarm
327 alarm(0);
328
329 # check queue length
330 if ($lines[0]=~/^messages in queue: (\d+)/) {
331 $msg_q = $1 ;
332 }else{
333 print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n";
334 exit $ERRORS{'UNKNOWN'};
335 }
336
337 # check messages not processed
338 if ($lines[1]=~/^messages in queue but not yet preprocessed: (\d+)/) {
339 my $msg_p = $1;
340 }else{
341 print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n";
342 exit $ERRORS{'UNKNOWN'};
343 }
344
345
346 # check queue length(s)
347 if ($msg_q == 0){
348 $msg = "OK: qmail-qstat reports queue is empty";
349 $state = $ERRORS{'OK'};
350 } else {
351 print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose;
352
353 # overall queue length
354 if ($msg_q < $opt_w) {
355 $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
356 $state = $ERRORS{'OK'};
357 }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) {
358 $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
359 $state = $ERRORS{'WARNING'};
360 }else {
361 $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
362 $state = $ERRORS{'CRITICAL'};
363 }
364
365 # check messages not yet preprocessed (only compare is $opt_W and $opt_C
366 # are defined)
367
368 if (defined $opt_W) {
369 $msg .= "[Preprocessed = $msg_p]";
370 if ($msg_p >= $opt_W && $msg_p < $opt_C ) {
371 $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ;
372 }elsif ($msg_p >= $opt_C ) {
373 $state = $ERRORS{"CRITICAL"} ;
374 }
375 }
376 }
377
378
379
380} # end of ($mailq eq "qmail")
381
382
108 383
109# Perfdata support 384# Perfdata support
110print "$msg | mailq = $msg_q\n"; 385print "$msg |mailq=$msg_q\n";
111exit $state; 386exit $state;
112 387
113 388
@@ -120,8 +395,11 @@ sub process_arguments(){
120 ("V" => \$opt_V, "version" => \$opt_V, 395 ("V" => \$opt_V, "version" => \$opt_V,
121 "v" => \$opt_v, "verbose" => \$opt_v, 396 "v" => \$opt_v, "verbose" => \$opt_v,
122 "h" => \$opt_h, "help" => \$opt_h, 397 "h" => \$opt_h, "help" => \$opt_h,
398 "M:s" => \$opt_M, "mailserver:s" => \$opt_M, # mailserver (default sendmail)
123 "w=i" => \$opt_w, "warning=i" => \$opt_w, # warning if above this number 399 "w=i" => \$opt_w, "warning=i" => \$opt_w, # warning if above this number
124 "c=i" => \$opt_c, "critical=i" => \$opt_c, # critical if above this number 400 "c=i" => \$opt_c, "critical=i" => \$opt_c, # critical if above this number
401 "W=i" => \$opt_W, "Warning=i" => \$opt_W, # warning if above this number
402 "C=i" => \$opt_C, "Critical=i" => \$opt_C, # critical if above this number
125 "t=i" => \$opt_t, "timeout=i" => \$opt_t 403 "t=i" => \$opt_t, "timeout=i" => \$opt_t
126 ); 404 );
127 405
@@ -149,31 +427,65 @@ sub process_arguments(){
149 } 427 }
150 428
151 if ( $opt_w >= $opt_c) { 429 if ( $opt_w >= $opt_c) {
152 print "Warning cannot be greater than Critical!\n"; 430 print "Warning (-w) cannot be greater than Critical (-c)!\n";
431 exit $ERRORS{'UNKNOWN'};
432 }
433
434 if (defined $opt_W && ! defined !$opt_C) {
435 print "Need -C if using -W\n";
153 exit $ERRORS{'UNKNOWN'}; 436 exit $ERRORS{'UNKNOWN'};
437 }elsif(defined $opt_W && defined $opt_C) {
438 if ($opt_W >= $opt_C) {
439 print "Warning (-W) cannot be greater than Critical (-C)!\n";
440 exit $ERRORS{'UNKNOWN'};
441 }
154 } 442 }
155 443
444 if (defined $opt_M) {
445 if ($opt_M =~ /sendmail/ || $opt_M =~ /qmail/ ) {
446 $mailq = $opt_M ;
447 }elsif( $opt_M eq ''){
448 $mailq = 'sendmail';
449 }else{
450 print "-M: $opt_M is not supported\n";
451 exit $ERRORS{'UNKNOWN'};
452 }
453 }else{
454 $mailq = 'sendmail' ;
455 }
456
156 return $ERRORS{'OK'}; 457 return $ERRORS{'OK'};
157} 458}
158 459
159sub print_usage () { 460sub print_usage () {
160 print "Usage: $PROGNAME [-w <warn>] [-c <crit>] [-t <timeout>] [-v verbose]\n"; 461 print "Usage: $PROGNAME [-w <warn>] [-c <crit>] [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose]\n";
161} 462}
162 463
163sub print_help () { 464sub print_help () {
164 print_revision($PROGNAME,'$Revision$'); 465 print_revision($PROGNAME,'$Revision$');
165 print "Copyright (c) 2002 Subhendu Ghosh\n"; 466 print "Copyright (c) 2002 Subhendu Ghosh/Carlos Canau/Benjamin Schmid\n";
166 print "\n"; 467 print "\n";
167 print_usage(); 468 print_usage();
168 print "\n"; 469 print "\n";
169 print " Checks the number of messages in the mail queue\n"; 470 print " Checks the number of messages in the mail queue (supports multiple sendmail queues, qmail)\n";
170 print " Feedback/patches to support non-sendmail mailqueue welcome\n\n"; 471 print " Feedback/patches to support non-sendmail mailqueue welcome\n\n";
171 print "-w (--warning) = Min. number of messages in queue to generate warning\n"; 472 print "-w (--warning) = Min. number of messages in queue to generate warning\n";
172 print "-c (--critical) = Min. number of messages in queu to generate critical alert ( w < c )\n"; 473 print "-c (--critical) = Min. number of messages in queu to generate critical alert ( w < c )\n";
474 print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n";
475 print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n";
173 print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n"; 476 print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n";
477 print "-M (--mailserver) = [ sendmail | qmail ] (default = sendmail)\n";
174 print "-h (--help)\n"; 478 print "-h (--help)\n";
175 print "-V (--version)\n"; 479 print "-V (--version)\n";
176 print "-v (--verbose) = deebugging output\n"; 480 print "-v (--verbose) = debugging output\n";
481 print "\n\n";
482 print "Note: -w and -c are required arguments. -W and -C are optional.\n";
483 print " -W and -C are applied to domains listed on the queues - both FROM and TO. (sendmail)\n";
484 print " -W and -C are applied message not yet preproccessed. (qmail)\n";
485 print " This plugin uses the system mailq command (sendmail) or qmail-stat (qmail)\n";
486 print " to look at the queues. Mailq can usually only be accessed by root or \n";
487 print " a TrustedUser. You will have to set appropriate permissions for the plugin to work.\n";
488 print "";
177 print "\n\n"; 489 print "\n\n";
178 support(); 490 support();
179} 491}