Re: ignore inflight messages in daily output

2016-01-03 Thread Stuart Henderson
On 2016/01/02 18:05, Devin Reade wrote:
> If mail is in the process of being sent (rather than sitting in
> the queue) we probably shouldn't complain about it.  If something
> like daily.local causes mail to be sent this can end up with a lot
> of false positives.  (False in the sense that nothing is actually
> wrong, so the system should be quite about it.)

I'm not sure about this... We don't exclude these for other MTAs and
it means you might miss a real delayed mail that is being reattempted
at the time daily(8) runs.


> 
> Index: etc/daily
> ===
> RCS file: /cvs/src/etc/daily,v
> retrieving revision 1.84
> diff -u -p -r1.84 daily
> --- etc/daily 30 Dec 2015 22:59:53 -  1.84
> +++ etc/daily 2 Jan 2016 06:25:55 -
> @@ -138,11 +138,15 @@ else
>  fi
>  
>  # The first two regular expressions handle sendmail, the third postfix.
> +# The fourth is for smtpd(8), and tries to allow for the possibility that
> +# something invoked from /etc/daily.local has just sent mail which is
> +# now in the process of being sent (and would thus often be a false 
> positive).
>  # When the queue is empty, smtpd(8) and exim -bp keep silent.
>  next_part "mail:"
>  mailq | grep -v -e "^/var/spool/mqueue is empty$" \
>   -e "^[[:blank:]]*Total requests: 0$" \
> - -e "^Mail queue is empty$"
> + -e "^Mail queue is empty$" \
> + -e "|inflight|0|$"
>  
>  next_part "network:"
>  if [ "X$VERBOSESTATUS" != X0 ]; then
> 



Re: ignore inflight messages in daily output

2016-01-03 Thread Devin Reade
--On Sunday, January 03, 2016 01:22:34 PM + Stuart Henderson 
 wrote:



On 2016/01/02 18:05, Devin Reade wrote:

If mail is in the process of being sent (rather than sitting in
the queue) we probably shouldn't complain about it.  If something
like daily.local causes mail to be sent this can end up with a lot
of false positives.  (False in the sense that nothing is actually
wrong, so the system should be quite about it.)


I'm not sure about this... We don't exclude these for other MTAs and
it means you might miss a real delayed mail that is being reattempted
at the time daily(8) runs.


For years I've had a script run from daily.local that will, under some
circumstances, trigger an email to be sent (and not necessarily to the
same addresses that get root mail).  Maybe it was a timing issue, but
when sendmail was the default MTA, the fact that this message was
being sent was AFAIK not once reported by daily's mailq invocation.
It was only after switching to smptd that the reports started.

Right now the diff is matching against "|inflight|0|$".  If I changed
that to "|0|inflight|0|$", then it would only match against the first
attempted delivery for that message.  With such a change, would the
diff be acceptable?

My fallback position is to run the mentioned script via its own cron
entry at a different time, but I'd prefer to stick to daily.local.




Index: etc/daily
===
RCS file: /cvs/src/etc/daily,v
retrieving revision 1.84
diff -u -p -r1.84 daily
--- etc/daily   30 Dec 2015 22:59:53 -  1.84
+++ etc/daily   2 Jan 2016 06:25:55 -
@@ -138,11 +138,15 @@ else
 fi

 # The first two regular expressions handle sendmail, the third postfix.
+# The fourth is for smtpd(8), and tries to allow for the possibility
that +# something invoked from /etc/daily.local has just sent mail which
is +# now in the process of being sent (and would thus often be a false
positive).
 # When the queue is empty, smtpd(8) and exim -bp keep silent.
 next_part "mail:"
 mailq | grep -v -e "^/var/spool/mqueue is empty$" \
-e "^[[:blank:]]*Total requests: 0$" \
-   -e "^Mail queue is empty$"
+   -e "^Mail queue is empty$" \
+   -e "|inflight|0|$"

 next_part "network:"
 if [ "X$VERBOSESTATUS" != X0 ]; then










ignore inflight messages in daily output

2016-01-02 Thread Devin Reade
If mail is in the process of being sent (rather than sitting in
the queue) we probably shouldn't complain about it.  If something
like daily.local causes mail to be sent this can end up with a lot
of false positives.  (False in the sense that nothing is actually
wrong, so the system should be quite about it.)


Index: etc/daily
===
RCS file: /cvs/src/etc/daily,v
retrieving revision 1.84
diff -u -p -r1.84 daily
--- etc/daily   30 Dec 2015 22:59:53 -  1.84
+++ etc/daily   2 Jan 2016 06:25:55 -
@@ -138,11 +138,15 @@ else
 fi
 
 # The first two regular expressions handle sendmail, the third postfix.
+# The fourth is for smtpd(8), and tries to allow for the possibility that
+# something invoked from /etc/daily.local has just sent mail which is
+# now in the process of being sent (and would thus often be a false positive).
 # When the queue is empty, smtpd(8) and exim -bp keep silent.
 next_part "mail:"
 mailq | grep -v -e "^/var/spool/mqueue is empty$" \
-e "^[[:blank:]]*Total requests: 0$" \
-   -e "^Mail queue is empty$"
+   -e "^Mail queue is empty$" \
+   -e "|inflight|0|$"
 
 next_part "network:"
 if [ "X$VERBOSESTATUS" != X0 ]; then