Prechádzať zdrojové kódy

Merge pull request #764 from tsadpbb/754-add-mailq_args-to-exim

 Fix [#754]: Add config directory option for exim mailservers
dylan-at-nagios 1 rok pred
rodič
commit
7a811ff8ec
2 zmenil súbory, kde vykonal 8 pridanie a 5 odobranie
  1. 3 0
      NEWS
  2. 5 5
      plugins-scripts/check_mailq.pl

+ 3 - 0
NEWS

@@ -1,4 +1,7 @@
 This file documents the major additions and syntax changes between releases.
+2.4.10 2024-04-30
+	FIXES
+	check_mailq: Add config directory option and update pattern matching for exim mailservers (#754)
 
 2.4.9 2024-03-21
 	FIXES

+ 5 - 5
plugins-scripts/check_mailq.pl

@@ -489,13 +489,13 @@ elsif ( $mailq eq "qmail" ) {
 elsif ( $mailq eq "exim" ) {
 	## 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";
+		if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ$mailq_args 2>&1 | " ) ) {
+			print "ERROR: could not open $utils::PATH_TO_MAILQ$mailq_args\n";
 			exit $ERRORS{'UNKNOWN'};
 		}
 	}elsif( defined $utils::PATH_TO_MAILQ){
 		unless (-x $utils::PATH_TO_MAILQ) {
-			print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n";
+			print "ERROR: $utils::PATH_TO_MAILQ$mailq_args is not executable by (uid $>:gid($)))\n";
 			exit $ERRORS{'UNKNOWN'};
 		}
 	} else {
@@ -507,14 +507,14 @@ elsif ( $mailq eq "exim" ) {
 	    #22m  1.7K 19aEEr-0007hx-Dy <> *** frozen ***
             #root@exlixams.glups.fr
 
-	    if (/\s[\w\d]{6}-[\w\d]{6}-[\w\d]{2}\s/) { # message id 19aEEr-0007hx-Dy
+	    if ( (/\s[\w\d]{6}-[\w\d]{6}-[\w\d]{2}\s/) || (/\s[\w\d]{6}-[\w\d]{11}-[\w\d]{4}\s/) ) { # message id 19aEEr-0007hx-Dy or 16VDhn-000000001bo-D342
 		$msg_q++ ;
 	    }
 	}
 	close(MAILQ) ;
 
 	if ( $? ) {
-		print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_MAILQ",$/;
+		print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_MAILQ$mailq_args",$/;
 		exit $ERRORS{CRITICAL};
 	}
 	if ($msg_q < $opt_w) {