[monitoring-plugins] Fixing nullmailer regex

waja git at monitoring-plugins.org
Wed Jan 18 22:10:11 CET 2023


    Module: monitoring-plugins
    Branch: master
    Commit: 916572c1aecc37ebfea474f952df61d15d2f60b8
    Author: andrew bezella <abezella at archive.org>
 Committer: waja <waja at users.noreply.github.com>
      Date: Wed Oct 19 21:33:18 2022 +0200
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=916572c

Fixing nullmailer regex

attached is a patch that updates the format expected in the nullmailer
mailq output.  the regex is a little more flexible and less specific
than the previous version.

---

 plugins-scripts/check_mailq.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl
index 4c72332..27073d3 100755
--- a/plugins-scripts/check_mailq.pl
+++ b/plugins-scripts/check_mailq.pl
@@ -537,9 +537,9 @@ elsif ( $mailq eq "nullmailer" ) {
 	}
 
 	while (<MAILQ>) {
-	    #2006-06-22 16:00:00  282 bytes
+	    #2022-08-25 01:30:40 502 bytes from <user at example.com>
 
-	    if (/^[1-9][0-9]*-[01][0-9]-[0-3][0-9]\s[0-2][0-9]\:[0-5][0-9]\:[0-5][0-9]\s+[0-9]+\sbytes/) {
+	    if (/^\d{4}-\d{2}-\d{2}\s+\d{2}\:\d{2}\:\d{2}\s+\d+\sbytes/) {
 		$msg_q++ ;
 	    }
 	}



More information about the Commits mailing list