[monitoring-plugins] Fix regexp for nullmailer "mailq" output
Stephane Lapie
git at monitoring-plugins.org
Mon Nov 29 15:40:11 CET 2021
Module: monitoring-plugins
Branch: master
Commit: 541322969e27b07566c55448d749bc64ab7ae5c0
Author: Stephane Lapie <stephane.lapie at asahinet.com>
Date: Wed Jun 7 15:12:53 2017 +0900
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=5413229
Fix regexp for nullmailer "mailq" output
As it currently is, the regular expression does not match mailq command
output on a Debian Jessie setup.
Three erroneous behaviors fixed :
- Meaningful lines do not end with the "bytes" word
- There might be one or more space before the byte count, not 2
- Time match was completely broken, it only accounted for 0-29 minutes
and 0-29 seconds.
---
plugins-scripts/check_mailq.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl
index 32f498d..1fc15ff 100755
--- a/plugins-scripts/check_mailq.pl
+++ b/plugins-scripts/check_mailq.pl
@@ -533,7 +533,7 @@ elsif ( $mailq eq "nullmailer" ) {
while (<MAILQ>) {
#2006-06-22 16:00:00 282 bytes
- if (/^[1-9][0-9]*-[01][0-9]-[0-3][0-9]\s[0-2][0-9]\:[0-2][0-9]\:[0-2][0-9]\s{2}[0-9]+\sbytes$/) {
+ 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/) {
$msg_q++ ;
}
}
More information about the Commits
mailing list