Postfix 管道延迟

Postfix 管道延迟

我在 Raspberry Pi 上运行 Postfix。我的户外摄像头检测到任何动作时都会发送电子邮件。我正在将此电子邮件发送到脚本。总是有 2-3 秒的延迟,但 Pi 有 99% 处于空闲状态。所以我认为这是一个配置问题。

日志:

Oct  3 18:07:55 raspberrypi postfix/smtpd[11348]: connect from OutdoorCam.fritz.box[192.168.173.39]
Oct  3 18:07:55 raspberrypi postfix/smtpd[11348]: NOQUEUE: filter: RCPT from OutdoorCam.fritz.box[192.168.173.39]: <[email protected]>: Sender address triggers FILTER triggerCamAlert:dummy; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<localhost>
Oct  3 18:07:55 raspberrypi postfix/smtpd[11348]: 38F713FED0: client=OutdoorCam.fritz.box[192.168.173.39]
Oct  3 18:07:55 raspberrypi postfix/cleanup[11351]: 38F713FED0: message-id=<>
Oct  3 18:07:55 raspberrypi postfix/qmgr[24540]: 38F713FED0: from=<[email protected]>, size=469, nrcpt=1 (queue active)
Oct  3 18:07:55 raspberrypi postfix/smtpd[11348]: disconnect from OutdoorCam.fritz.box[192.168.173.39]
Oct  3 18:07:57 raspberrypi postfix/pipe[11352]: 38F713FED0: to=<fhem@raspberrypi>, orig_to=<[email protected]>, relay=triggerCamAlert, delay=2.5, delays=0.07/0/0/2.4, dsn=2.0.0, status=sent (delivered via triggerCamAlert service)
Oct  3 18:07:57 raspberrypi postfix/qmgr[24540]: 38F713FED0: removed

主配置文件

# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd
#smtp      inet  n       -       -       -       1       postscreen
#smtpd     pass  -       -       -       -       -       smtpd
#dnsblog   unix  -       -       -       -       0       dnsblog
#tlsproxy  unix  -       -       -       -       0       tlsproxy
#submission inet n       -       -       -       -       smtpd
#  -o syslog_name=postfix/submission
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#smtps     inet  n       -       -       -       -       smtpd
#  -o syslog_name=postfix/smtps
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628       inet  n       -       -       -       -       qmqpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       n       300     1       oqmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       smtp
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}

triggerCamAlert unix - n n - - pipe flags=X user=filter argv=/opt/fhem/triggerCamAlert.sh

知道什么可能导致这种延迟吗?

欢迎任何提示!

托贝利克斯

答案1

对于有洞察力的读者来说,信息已经在您的日志文件中了。

你估计“延迟 2-3 秒”您的示例中的时间实际上正好是 2.5 秒:

Oct  3 18:07:57 raspberrypi postfix/pipe[11352]: ... delay=2.5, delays=0.07/0/0/2.4 ...
                                                     ^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^

delays=a/b/c/d实际上是对 SMTP 事务的哪一部分需要多少时间的细分,如本文所述问答

最长的消息传输时间是2.4秒。

这只是因为发送者需要很长时间才能提交完整的消息,而这并不是您的 Postfix 配置本身的错误。

相关内容