summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Wagner <waja@cyconet.org>2013-10-01 13:06:51 (GMT)
committerJan Wagner <waja@cyconet.org>2023-02-03 14:44:52 (GMT)
commit12ae1fb6627bfef419fb4571a7189909107f5e6e (patch)
treeee66dca0117f70684ad20d0d043a773a0fe35e77
parentfc8a233854c0d59cf637e982b84c836920d718bd (diff)
downloadmonitoring-plugins-12ae1fb6627bfef419fb4571a7189909107f5e6e.tar.gz
check_mailq.pl: separate submission queuerefs/pull/1192/head
check_mailq.pl ignores the separate submission queue used in (modern?) sendmail implementations. For the queue output below with one message in the submission queue and no messages in the transport queue, check_mailq.pl reports zero messages in the queue because the request count from the last queue always overwrites previous queues. If the sendmail MTA isn't running or has become wedged, messages will sit in the submission queue forever. The attached patch fixes this in a backwards compatible way (i.e., it shouldn't break any of the currently supported formats). -- Just turning attached patch of github issue #972 into a push request. (Closes #972)
-rw-r--r--THANKS.in1
-rwxr-xr-xplugins-scripts/check_mailq.pl36
2 files changed, 31 insertions, 6 deletions
diff --git a/THANKS.in b/THANKS.in
index 73b3b3a..b132744 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -405,3 +405,4 @@ Robert Bohne
405Wolfgang Nieder 405Wolfgang Nieder
406andrew bezella 406andrew bezella
407Lorenz Gruenwald 407Lorenz Gruenwald
408John Morrissey
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl
index 27073d3..f02c90f 100755
--- a/plugins-scripts/check_mailq.pl
+++ b/plugins-scripts/check_mailq.pl
@@ -149,7 +149,26 @@ if ($mailq eq "sendmail") {
149##/var/spool/mqueue/qF/df is empty 149##/var/spool/mqueue/qF/df is empty
150## Total Requests: 1 150## Total Requests: 1
151 151
152 152# separate submission/transport queues, empty
153## MSP Queue status...
154## /var/spool/mqueue-client is empty
155## Total requests: 0
156## MTA Queue status...
157## /var/spool/mqueue is empty
158## Total requests: 0
159# separate submission/transport queues: 1
160## MSP Queue status...
161## /var/spool/mqueue-client (1 request)
162## -----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
163## oAJEfhdW014123 5 Fri Nov 19 14:41 jwm
164## (Deferred: Connection refused by [127.0.0.1])
165## root
166## Total requests: 1
167## MTA Queue status...
168## /var/spool/mqueue is empty
169## Total requests: 0
170
171 my $this_msg_q = 0;
153 while (<MAILQ>) { 172 while (<MAILQ>) {
154 173
155 # match email addr on queue listing 174 # match email addr on queue listing
@@ -189,13 +208,18 @@ if ($mailq eq "sendmail") {
189 # 208 #
190 # single queue: first line 209 # single queue: first line
191 # multi queue: one for each queue. overwrite on multi queue below 210 # multi queue: one for each queue. overwrite on multi queue below
192 $msg_q = $1 ; 211 $this_msg_q = $1 ;
212 $msg_q += $1 ;
193 } 213 }
194 } elsif (/^\s+Total\sRequests:\s(\d+)$/i) { 214 } elsif (/^\s+Total\sRequests:\s(\d+)$/i) {
195 print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ; 215 if ($this_msg_q) {
196 # 216 $this_msg_q = 0 ;
197 # multi queue: last line 217 } else {
198 $msg_q = $1 ; 218 print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ;
219 #
220 # multi queue: last line
221 $msg_q += $1 ;
222 }
199 } 223 }
200 224
201 } 225 }