1 #!/usr/local/bin/perl -w
3 # check_mailq - check to see how many messages are in the smtp queue awating
4 # transmittal.
5 #
6 # Initial version support sendmail's mailq command
7 # Support for mutiple sendmail queues (Carlos Canau)
8 # Support for qmail (Benjamin Schmid)
10 # License Information:
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #
25 ############################################################################
27 use POSIX;
28 use strict;
29 use Getopt::Long;
30 use 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);
33 use lib utils.pm;
34 use utils qw(%ERRORS &print_revision &support &usage );
37 sub print_help ();
38 sub print_usage ();
39 sub process_arguments ();
41 $ENV{'PATH'}='';
42 $ENV{'BASH_ENV'}='';
43 $ENV{'ENV'}='';
44 $PROGNAME = "check_mailq";
45 $mailq = 'sendmail'; # default
46 $msg_q = 0 ;
47 $msg_p = 0 ;
48 $state = $ERRORS{'UNKNOWN'};
50 Getopt::Long::Configure('bundling');
51 $status = process_arguments();
52 if ($status){
53 print "ERROR: processing arguments\n";
54 exit $ERRORS{"UNKNOWN"};
55 }
57 $SIG{'ALRM'} = sub {
58 print ("ERROR: timed out waiting for $utils::PATH_TO_MAILQ \n");
59 exit $ERRORS{"WARNING"};
60 };
61 alarm($opt_t);
63 # switch based on MTA
65 if ($mailq eq "sendmail") {
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";
80 exit $ERRORS{'UNKNOWN'};
81 }
82 # single queue empty
83 ##/var/spool/mqueue is empty
84 # single queue: 1
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>
91 # multi queue empty
92 ##/var/spool/mqueue/q0/df is empty
93 ##/var/spool/mqueue/q1/df is empty
94 ##/var/spool/mqueue/q2/df is empty
95 ##/var/spool/mqueue/q3/df is empty
96 ##/var/spool/mqueue/q4/df is empty
97 ##/var/spool/mqueue/q5/df is empty
98 ##/var/spool/mqueue/q6/df is empty
99 ##/var/spool/mqueue/q7/df is empty
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
133 while (<MAILQ>) {
135 # match email addr on queue listing
136 if ( (/<.*@.*\.(\w+\.\w+)>/) || (/<.*@(\w+\.\w+)>/) ) {
137 my $domain = $1;
138 if (/^\w+/) {
139 print "$utils::PATH_TO_MAILQ = srcdomain = $domain \n" if $verbose ;
140 $srcdomains{$domain} ++;
141 }
142 next;
143 }
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+)\.\)/ ) ) {
155 print "$utils::PATH_TO_MAILQ = dstdomain = $1 \n" if $verbose ;
156 $dstdomains{$1} ++;
157 }
159 if (/\s+\(I\/O\serror\)/) {
160 print "$utils::PATH_TO_MAILQ = dstdomain = UNKNOWN \n" if $verbose ;
161 $dstdomains{'UNKNOWN'} ++;
162 }
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 }
181 }
184 ## close mailq
186 close (MAILQ);
187 # declare an error if we also get a non-zero return code from mailq
188 # unless already set to critical
189 if ( $? ) {
190 $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ;
191 print "STDERR $?: $!\n" if $verbose;
192 $msg = "$state: (stderr)\n";
193 }
195 ## shut off the alarm
196 alarm(0);
200 ## now check the queue length(s)
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;
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 }
220 # check for domain specific queue lengths if requested
221 if (defined $opt_W) {
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;
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 }
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;
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 }
291 } # End of queue length thresholds
293 }
295 } # end of ($mailq eq "sendmail")
296 elsif ( $mailq eq "postfix" ) {
298 ## open mailq
299 if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
300 if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) {
301 print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
302 exit $ERRORS{'UNKNOWN'};
303 }
304 }elsif( defined $utils::PATH_TO_MAILQ){
305 unless (-x $utils::PATH_TO_MAILQ) {
306 print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n";
307 exit $ERRORS{'UNKNOWN'};
308 }
309 } else {
310 print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n";
311 exit $ERRORS{'UNKNOWN'};
312 }
315 @lines = reverse <MAILQ>;
317 # close qmail-qstat
318 close MAILQ;
319 # declare an error if we also get a non-zero return code from mailq
320 # unless already set to critical
321 if ( $? ) {
322 $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ;
323 print "STDERR $?: $!\n" if $verbose;
324 $msg = "$state: (stderr)\n";
325 }
327 ## shut off the alarm
328 alarm(0);
330 # check queue length
331 if ($lines[0]=~/Kbytes in (\d+)/) {
332 $msg_q = $1 ;
333 }elsif ($lines[0]=~/Mail queue is empty/) {
334 $msg_q = 0;
335 }else{
336 print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n";
337 exit $ERRORS{'UNKNOWN'};
338 }
340 # check messages not processed
341 #if ($lines[1]=~/^messages in queue but not yet preprocessed: (\d+)/) {
342 # my $msg_p = $1;
343 #}else{
344 # print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n";
345 # exit $ERRORS{'UNKNOWN'};
346 #}
348 # check queue length(s)
349 if ($msg_q == 0){
350 $msg = "OK: mailq reports queue is empty";
351 $state = $ERRORS{'OK'};
352 } else {
353 print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose;
355 # overall queue length
356 if ($msg_q < $opt_w) {
357 $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
358 $state = $ERRORS{'OK'};
359 }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) {
360 $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
361 $state = $ERRORS{'WARNING'};
362 }else {
363 $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
364 $state = $ERRORS{'CRITICAL'};
365 }
367 # check messages not yet preprocessed (only compare is $opt_W and $opt_C
368 # are defined)
370 #if (defined $opt_W) {
371 # $msg .= "[Preprocessed = $msg_p]";
372 # if ($msg_p >= $opt_W && $msg_p < $opt_C ) {
373 # $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ;
374 # }elsif ($msg_p >= $opt_C ) {
375 # $state = $ERRORS{"CRITICAL"} ;
376 # }
377 #}
378 }
379 } # end of ($mailq eq "postfixl")
380 elsif ( $mailq eq "qmail" ) {
382 # open qmail-qstat
383 if ( defined $utils::PATH_TO_QMAIL_QSTAT && -x $utils::PATH_TO_QMAIL_QSTAT ) {
384 if (! open (MAILQ, "$utils::PATH_TO_QMAIL_QSTAT | " ) ) {
385 print "ERROR: could not open $utils::PATH_TO_QMAIL_QSTAT \n";
386 exit $ERRORS{'UNKNOWN'};
387 }
388 }elsif( defined $utils::PATH_TO_QMAIL_QSTAT){
389 unless (-x $utils::PATH_TO_QMAIL_QSTAT) {
390 print "ERROR: $utils::PATH_TO_QMAIL_QSTAT is not executable by (uid $>:gid($)))\n";
391 exit $ERRORS{'UNKNOWN'};
392 }
393 } else {
394 print "ERROR: \$utils::PATH_TO_QMAIL_QSTAT is not defined\n";
395 exit $ERRORS{'UNKNOWN'};
396 }
398 @lines = <MAILQ>;
400 # close qmail-qstat
401 close MAILQ;
402 # declare an error if we also get a non-zero return code from mailq
403 # unless already set to critical
404 if ( $? ) {
405 $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ;
406 print "STDERR $?: $!\n" if $verbose;
407 $msg = "$state: (stderr)\n";
408 }
410 ## shut off the alarm
411 alarm(0);
413 # check queue length
414 if ($lines[0]=~/^messages in queue: (\d+)/) {
415 $msg_q = $1 ;
416 }else{
417 print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n";
418 exit $ERRORS{'UNKNOWN'};
419 }
421 # check messages not processed
422 if ($lines[1]=~/^messages in queue but not yet preprocessed: (\d+)/) {
423 my $msg_p = $1;
424 }else{
425 print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n";
426 exit $ERRORS{'UNKNOWN'};
427 }
430 # check queue length(s)
431 if ($msg_q == 0){
432 $msg = "OK: qmail-qstat reports queue is empty";
433 $state = $ERRORS{'OK'};
434 } else {
435 print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose;
437 # overall queue length
438 if ($msg_q < $opt_w) {
439 $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
440 $state = $ERRORS{'OK'};
441 }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) {
442 $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
443 $state = $ERRORS{'WARNING'};
444 }else {
445 $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
446 $state = $ERRORS{'CRITICAL'};
447 }
449 # check messages not yet preprocessed (only compare is $opt_W and $opt_C
450 # are defined)
452 if (defined $opt_W) {
453 $msg .= "[Preprocessed = $msg_p]";
454 if ($msg_p >= $opt_W && $msg_p < $opt_C ) {
455 $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ;
456 }elsif ($msg_p >= $opt_C ) {
457 $state = $ERRORS{"CRITICAL"} ;
458 }
459 }
460 }
464 } # end of ($mailq eq "qmail")
468 # Perfdata support
469 print "$msg |mailq=$msg_q\n";
470 exit $state;
473 #####################################
474 #### subs
477 sub process_arguments(){
478 GetOptions
479 ("V" => \$opt_V, "version" => \$opt_V,
480 "v" => \$opt_v, "verbose" => \$opt_v,
481 "h" => \$opt_h, "help" => \$opt_h,
482 "M:s" => \$opt_M, "mailserver:s" => \$opt_M, # mailserver (default sendmail)
483 "w=i" => \$opt_w, "warning=i" => \$opt_w, # warning if above this number
484 "c=i" => \$opt_c, "critical=i" => \$opt_c, # critical if above this number
485 "W=i" => \$opt_W, "Warning=i" => \$opt_W, # warning if above this number
486 "C=i" => \$opt_C, "Critical=i" => \$opt_C, # critical if above this number
487 "t=i" => \$opt_t, "timeout=i" => \$opt_t
488 );
490 if ($opt_V) {
491 print_revision($PROGNAME,'$Revision$ ');
492 exit $ERRORS{'OK'};
493 }
495 if ($opt_h) {
496 print_help();
497 exit $ERRORS{'OK'};
498 }
500 if (defined $opt_v ){
501 $verbose = $opt_v;
502 }
504 unless (defined $opt_t) {
505 $opt_t = $utils::TIMEOUT ; # default timeout
506 }
508 unless ( defined $opt_w && defined $opt_c ) {
509 print_usage();
510 exit $ERRORS{'UNKNOWN'};
511 }
513 if ( $opt_w >= $opt_c) {
514 print "Warning (-w) cannot be greater than Critical (-c)!\n";
515 exit $ERRORS{'UNKNOWN'};
516 }
518 if (defined $opt_W && ! defined !$opt_C) {
519 print "Need -C if using -W\n";
520 exit $ERRORS{'UNKNOWN'};
521 }elsif(defined $opt_W && defined $opt_C) {
522 if ($opt_W >= $opt_C) {
523 print "Warning (-W) cannot be greater than Critical (-C)!\n";
524 exit $ERRORS{'UNKNOWN'};
525 }
526 }
528 if (defined $opt_M) {
529 if ($opt_M =~ /sendmail/ || $opt_M =~ /qmail/ || $opt_M =~ /postfix/ ) {
530 $mailq = $opt_M ;
531 }elsif( $opt_M eq ''){
532 $mailq = 'sendmail';
533 }else{
534 print "-M: $opt_M is not supported\n";
535 exit $ERRORS{'UNKNOWN'};
536 }
537 }else{
538 $mailq = 'sendmail' ;
539 }
541 return $ERRORS{'OK'};
542 }
544 sub print_usage () {
545 print "Usage: $PROGNAME [-w <warn>] [-c <crit>] [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose]\n";
546 }
548 sub print_help () {
549 print_revision($PROGNAME,'$Revision$');
550 print "Copyright (c) 2002 Subhendu Ghosh/Carlos Canau/Benjamin Schmid\n";
551 print "\n";
552 print_usage();
553 print "\n";
554 print " Checks the number of messages in the mail queue (supports multiple sendmail queues, qmail)\n";
555 print " Feedback/patches to support non-sendmail mailqueue welcome\n\n";
556 print "-w (--warning) = Min. number of messages in queue to generate warning\n";
557 print "-c (--critical) = Min. number of messages in queu to generate critical alert ( w < c )\n";
558 print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n";
559 print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n";
560 print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n";
561 print "-M (--mailserver) = [ sendmail | qmail | postfix ] (default = sendmail)\n";
562 print "-h (--help)\n";
563 print "-V (--version)\n";
564 print "-v (--verbose) = debugging output\n";
565 print "\n\n";
566 print "Note: -w and -c are required arguments. -W and -C are optional.\n";
567 print " -W and -C are applied to domains listed on the queues - both FROM and TO. (sendmail)\n";
568 print " -W and -C are applied message not yet preproccessed. (qmail)\n";
569 print " This plugin uses the system mailq command (sendmail) or qmail-stat (qmail)\n";
570 print " to look at the queues. Mailq can usually only be accessed by root or \n";
571 print " a TrustedUser. You will have to set appropriate permissions for the plugin to work.\n";
572 print "";
573 print "\n\n";
574 support();
575 }