From 4e430f577ade843a2e5300d9a863f242718fb734 Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Thu, 26 Oct 2023 11:04:36 +0200 Subject: check_mailq: remove trailing whitespaces diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl index 49156af..26336b9 100755 --- a/plugins-scripts/check_mailq.pl +++ b/plugins-scripts/check_mailq.pl @@ -1,7 +1,7 @@ #!@PERL@ -w # check_mailq - check to see how many messages are in the smtp queue awating -# transmittal. +# transmittal. # # Initial version support sendmail's mailq command # Support for multiple sendmail queues (Carlos Canau) @@ -42,7 +42,7 @@ sub print_usage (); sub process_arguments (); $ENV{'PATH'}='@TRUSTED_PATH@'; -$ENV{'BASH_ENV'}=''; +$ENV{'BASH_ENV'}=''; $ENV{'ENV'}=''; $PROGNAME = "check_mailq"; $mailq = 'sendmail'; # default @@ -84,7 +84,7 @@ alarm($opt_t); if ($mailq eq "sendmail") { - ## open mailq + ## open mailq if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) { print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; @@ -170,7 +170,7 @@ if ($mailq eq "sendmail") { my $this_msg_q = 0; while () { - + # match email addr on queue listing if ( (/<.*@.*\.(\w+\.\w+)>/) || (/<.*@(\w+\.\w+)>/) ) { my $domain = $1; @@ -180,21 +180,21 @@ if ($mailq eq "sendmail") { } next; } - + # # ... - # sendmail considers a message with more than one destiny, say N, to the same MX + # sendmail considers a message with more than one destiny, say N, to the same MX # to have N messages in queue. # we will only consider one in this code if (( /\s\(reply:\sread\serror\sfrom\s.*\.(\w+\.\w+)\.$/ ) || ( /\s\(reply:\sread\serror\sfrom\s(\w+\.\w+)\.$/ ) || ( /\s\(timeout\swriting\smessage\sto\s.*\.(\w+\.\w+)\.:/ ) || ( /\s\(timeout\swriting\smessage\sto\s(\w+\.\w+)\.:/ ) || - ( /\s\(host\smap:\slookup\s\(.*\.(\w+\.\w+)\):/ ) || ( /\s\(host\smap:\slookup\s\((\w+\.\w+)\):/ ) || + ( /\s\(host\smap:\slookup\s\(.*\.(\w+\.\w+)\):/ ) || ( /\s\(host\smap:\slookup\s\((\w+\.\w+)\):/ ) || ( /\s\(Deferred:\s.*\s.*\.(\w+\.\w+)\.\)/ ) || ( /\s\(Deferred:\s.*\s(\w+\.\w+)\.\)/ ) ) { - + print "$utils::PATH_TO_MAILQ = dstdomain = $1 \n" if $verbose ; $dstdomains{$1} ++; } - + if (/\s+\(I\/O\serror\)/) { print "$utils::PATH_TO_MAILQ = dstdomain = UNKNOWN \n" if $verbose ; $dstdomains{'UNKNOWN'} ++; @@ -221,13 +221,13 @@ if ($mailq eq "sendmail") { $msg_q += $1 ; } } - + } - + ## close mailq - close (MAILQ); + close (MAILQ); if ( $? ) { print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_MAILQ",$/; @@ -246,7 +246,7 @@ if ($mailq eq "sendmail") { $state = $ERRORS{'OK'}; } else { print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose; - + # overall queue length if ($msg_q < $opt_w) { $msg = "OK: $mailq mailq ($msg_q) is below threshold ($opt_w/$opt_c)"; @@ -261,12 +261,12 @@ if ($mailq eq "sendmail") { # check for domain specific queue lengths if requested if (defined $opt_W) { - + # Apply threshold to queue lengths FROM domain my @srckeys = sort { $srcdomains{$b} <=> $srcdomains{$a} } keys %srcdomains; my $srcmaxkey = $srckeys[0]; print "src max is $srcmaxkey with $srcdomains{$srcmaxkey} messages\n" if $verbose; - + if ($srcdomains{$srcmaxkey} >= $opt_W && $srcdomains{$srcmaxkey} < $opt_C) { if ($state == $ERRORS{'OK'}) { $msg = "WARNING: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)"; @@ -300,7 +300,7 @@ if ($mailq eq "sendmail") { my @dstkeys = sort { $dstdomains{$b} <=> $dstdomains{$a} } keys %dstdomains; my $dstmaxkey = $dstkeys[0]; print "dst max is $dstmaxkey with $dstdomains{$dstmaxkey} messages\n" if $verbose; - + if ($dstdomains{$dstmaxkey} >= $opt_W && $dstdomains{$dstmaxkey} < $opt_C) { if ($state == $ERRORS{'OK'}) { $msg = "WARNING: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)"; @@ -419,7 +419,7 @@ elsif ( $mailq eq "postfix" ) { } # end of ($mailq eq "postfix") elsif ( $mailq eq "qmail" ) { - # open qmail-qstat + # open qmail-qstat if ( defined $utils::PATH_TO_QMAIL_QSTAT && -x $utils::PATH_TO_QMAIL_QSTAT ) { if (! open (MAILQ, "$sudo $utils::PATH_TO_QMAIL_QSTAT | " ) ) { print "ERROR: could not open $utils::PATH_TO_QMAIL_QSTAT \n"; @@ -471,7 +471,7 @@ elsif ( $mailq eq "qmail" ) { $state = $ERRORS{'OK'}; } else { print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose; - + # overall queue length if ($msg_q < $opt_w) { $msg = "OK: $mailq mailq ($msg_q) is below threshold ($opt_w/$opt_c)"; @@ -486,7 +486,7 @@ elsif ( $mailq eq "qmail" ) { # check messages not yet preprocessed (only compare is $opt_W and $opt_C # are defined) - + if (defined $opt_W) { $msg .= "[Preprocessed = $msg_p]"; if ($msg_p >= $opt_W && $msg_p < $opt_C ) { @@ -495,13 +495,13 @@ elsif ( $mailq eq "qmail" ) { $state = $ERRORS{"CRITICAL"} ; } } - } - + } + } # end of ($mailq eq "qmail") elsif ( $mailq eq "exim" ) { - ## open mailq + ## open mailq if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) { print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; @@ -677,7 +677,7 @@ sub process_arguments(){ $mailq = 'sendmail'; } } - + return $ERRORS{'OK'}; } -- cgit v0.10-9-g596f