VMware vCenter Server 6.7 Update 3jがリリースされていた(VMware vCenter Server 6.7 Update 3j リリース ノート)ので、6.7 Update 3gからアップデートした。
しかし、その日の夕方、vSphere HAが発生した際にアラートメールが送信されないという事象が発生(Slackにも通知するようにしていたので気づけた)。
vSphere HAの対応完了後、メールが送信されなかった原因の調査を開始した。
vCenter側設定
「設定」→「全般」→「メール」で、
している。
また、通知が必要なアラームは「アラーム ルール」内で「Eメール通知を送信」を有効にしている。
状況確認
vCenterからイベントを確認すると、vSphere HA発生時にメール通知のアラートアクションが実行(成功)されていた。メールは送信できているようなので、配送経路を確認することに。
vCenter Server (vCSA)にSSHでログイン。
root@vcenter [ ~ ]# ss -ltno |grep :25
LISTEN 0 10 *:25 *:*
root@vCenter [ ~ ]# lsof -wi tcp:25
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sendmail 42253 root 4u IPv4 35690911 0t0 TCP *:smtp (LISTEN)
root@vCenter [ ~ ]#
Sendmailが起動しているようなので、ログを確認。
root@vcenter [ ~ ]# journalctl -u sendmail
...
Sep 24 01:08:28 vCenter sendmail[6464]: STARTTLS=server, relay=vcenter.example.com [127.0.0.1], version=TLSv1.2, verify=NO, cipher=AES256-GCM-SHA384, bits=256/256
Sep 24 01:08:28 vcenter.example.com sendmail[6464]: 08O18Sdo006464: from=<vcenter@example.com>, size=952, class=0, nrcpts=1, msgid=<202009240108.08O18Si5006443@vcenter.example.com>, proto=ESMTPS, daemon=MTA, relay=vcenter.example.com [127.0.0.1]
Sep 24 01:08:29 vcenter.example.com sendmail[6467]: 08O18Sdo006464: to=<alert@example.comm>, delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=120952, relay=192.0.2.1, dsn=5.1.2, stat=Host unknown (Name server: 192.0.2.1: host not found)
Sep 24 01:08:29 vcenter.example.com sendmail[6467]: 08O18Sdo006464: 08O18Tdn006467: DSN: Host unknown (Name server: 192.0.2.1: host not found)
...
メールサーバとして指定したIPアドレスを名前解決しようとして失敗している。
以前(6.7 Update 3g)の時はどうだったんだろう、と過去のログを見てみると、
root@vcenter [ ~ ]# journalctl -u sendmail
...
Sep 23 08:21:33 vcenter.example.com sendmail[23298]: STARTTLS=server, relay=vcenter.example.com [127.0.0.1], version=TLSv1.2, verify=NO, cipher=AES256-GCM-SHA384, bits=256/256
Sep 23 08:21:33 vcenter.example.com sendmail[23298]: 08N8LXOO023298: from=<vcenter@example.com>, size=1040, class=0, nrcpts=1, msgid=<202009230821.08N8LXsY023288@vcenter.example.com>, proto=ESMTPS, daemon=MTA, relay=vcenter.example.com [127.0.0.1]
Sep 23 08:21:33 vcenter.example.com sendmail[23302]: 08N8LXOO023298: to=<alert@example.com>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=121040, relay=mx.example.com. [192.0.2.111], dsn=2.0.0, stat=Sent (Ok: queued as A6EC63006B4)
...
あれ、vCenterの設定で指定したメールサーバを利用せず、自力でメール配送しているよ?
SR作成してVMwareに問い合わせつつ、もう少し中身を見てみることに。
/etc/mail/sendmail.cfの中身を確認してみる。
root@vcenter [ /etc/mail ]# head sendmail.cf
######################################################################
# /etc/mail/sendmail.cf
#
# Generated by /usr/lib/vmware-vpx/config_sendmail.sh on 2020/10/01 07:30:14
# generator script VERSION=1.0.0
######################################################################
#
# Copyright (c) 1998-2004, 2009, 2010 Proofpoint, Inc. and its suppliers.
# All rights reserved.
# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
root@vm2122 [ /etc/mail ]#
/etc/mail/sendmail.mcは利用せず、/usr/lib/vmware-vpx/config_sendmail.sh内でm4マクロを出力・m4に処理させてsendmail.cfを生成している。そして、vCenterでメールサーバを指定すると、その設定内容が変数${SMTP_RELAY_SERVER}にセットされて、
define(`SMART_HOST', `$SMTP_RELAY_SERVER')dnl
undefine(\confHOST_STATUS_DIRECTORY')dnl
というm4マクロが出力されることになる。
とりあえずの対処
回答は来てないけど、vCenterで指定するメールサーバを
のどちらかにすれば、解決できそうな気がする。
FQDNで指定
vCenterで設定変更後、sendmail.cfを確認する。
root@vcenter [ /etc/mail ]# grep DS sendmail.cf
DSmail.example.com
# Return-Receipt-To: header implies DSN request
# DHParameters (only required if DSA/DH is used)
root@vcenter [ /etc/mail ]#
メール通知させてみる
Sep 24 11:26:25 vcenter.example.com systemd[1]: Stopping Sendmail Mail Transport Agent...
Sep 24 11:26:25 vcenter.example.com systemd[1]: Stopped Sendmail Mail Transport Agent.
Sep 24 11:26:25 vcenter.example.com systemd[1]: Starting Sendmail Mail Transport Agent...
Sep 24 11:26:25 vcenter.example.com sendmail[15837]: starting daemon (8.15.2): SMTP+queueing@01:00:00
Sep 24 11:26:25 vcenter.example.com systemd[1]: Started Sendmail Mail Transport Agent.
Sep 24 11:33:06 vcenter.example.com sendmail[21533]: 08OBX6n7021533: from=<vcenter@example.com>, size=914, class=0, nrcpts=1, msgid=<202009241133.08OBX694021525@vcenter.example.com>, proto=ESMTPS, daemon=MTA, relay=vcenter.example.com [127.0.0.1]
Sep 24 11:33:06 vcenter.example.com sendmail[21535]: 08OBX6n7021533: to=<alert@example.com>, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=120914, relay=mail.example.com [192.0.2.1], dsn=2.0.0, stat=Sent (Ok: queued as 4B0E9DF9C4)
問題ない
IPアドレスを[]でくくって指定
vCenterで設定変更後、sendmail.cfを確認する。
root@vcenter [ /etc/mail ]# grep DS sendmail.cf
DS[192.0.2.1]
# Return-Receipt-To: header implies DSN request
# DHParameters (only required if DSA/DH is used)
変更されているので、メール通知させてみる。
Oct 01 07:42:34 vcenter.example.com sendmail[49694]: STARTTLS=server, relay=vcenter.example.com [127.0.0.1], version=TLSv1.2, verify=NO, cipher=AES256-GCM-SHA384, bits=256/256
Oct 01 07:42:34 vcenter.example.com sendmail[49694]: 0917gYZq049694: from=<vcenter@example.com>, size=1030, class=0, nrcpts=1, msgid=<202010010742.0917gYQ9049692@vcenter.example.com>, proto=ESMTPS, daemon=MTA, relay=vcenter.example.com [127.0.0.1]
Oct 01 07:42:34 vcenter.example.com sendmail[49696]: 0917gYZq049694: to=<alert@example.com>, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=121030, relay=[192.0.2.1] [192.0.2.1], dsn=2.0.0, stat=Sent (Ok: queued as D0271DFA38)
問題ない。
問い合わせへの回答
SRへの回答は、
- vCenterでメールサーバを指定する場合は、FQDN(DNSで名前解決できるもの)にするか、IPアドレスを[]でくくってほしい
- 6.7 Update 3gと6.7 Update 3jでメール配送方法が変更されている
- 事象は開発側にフィードバックした
- 情報公開については、検討する
でした。
追記
KB公開されました。