diff --git a/debian/patches/31_check_mailq_separate_submission_queue b/debian/patches/31_check_mailq_separate_submission_queue new file mode 100644 index 0000000..51bdd78 --- /dev/null +++ b/debian/patches/31_check_mailq_separate_submission_queue @@ -0,0 +1,77 @@ +From 12ae1fb6627bfef419fb4571a7189909107f5e6e Mon Sep 17 00:00:00 2001 +From: Jan Wagner +Date: Tue, 1 Oct 2013 15:06:51 +0200 +Subject: [PATCH] check_mailq.pl: separate submission queue + +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) +--- + +diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl +index 27073d3cc..f02c90fbc 100755 +--- a/plugins-scripts/check_mailq.pl ++++ b/plugins-scripts/check_mailq.pl +@@ -149,7 +149,26 @@ + ##/var/spool/mqueue/qF/df is empty + ## Total Requests: 1 + +- ++# separate submission/transport queues, empty ++## MSP Queue status... ++## /var/spool/mqueue-client is empty ++## Total requests: 0 ++## MTA Queue status... ++## /var/spool/mqueue is empty ++## Total requests: 0 ++# separate submission/transport queues: 1 ++## MSP Queue status... ++## /var/spool/mqueue-client (1 request) ++## -----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient----------- ++## oAJEfhdW014123 5 Fri Nov 19 14:41 jwm ++## (Deferred: Connection refused by [127.0.0.1]) ++## root ++## Total requests: 1 ++## MTA Queue status... ++## /var/spool/mqueue is empty ++## Total requests: 0 ++ ++ my $this_msg_q = 0; + while () { + + # match email addr on queue listing +@@ -189,13 +208,18 @@ + # + # single queue: first line + # multi queue: one for each queue. overwrite on multi queue below +- $msg_q = $1 ; ++ $this_msg_q = $1 ; ++ $msg_q += $1 ; + } + } elsif (/^\s+Total\sRequests:\s(\d+)$/i) { +- print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ; +- # +- # multi queue: last line +- $msg_q = $1 ; ++ if ($this_msg_q) { ++ $this_msg_q = 0 ; ++ } else { ++ print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ; ++ # ++ # multi queue: last line ++ $msg_q += $1 ; ++ } + } + + } diff --git a/debian/patches/series b/debian/patches/series index 7fde2dc..a9c0d8b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -18,7 +18,7 @@ 24_check_disk_fix_SI_units # feature patches 30_check_radius_radcli_1.3.1_support -31_checl_mailq_separate_submission_queue +31_check_mailq_separate_submission_queue 32_check_disk_add_ignore_missing 33_check_procs_exclude-process 34_check_curl_fix_compare_warning