最近我在 nagios 中没有收到任何电子邮件通知。我已经通过从 root 用户和 nagios 用户手动发送电子邮件进行了测试,并且成功收到了电子邮件。但是我没有收到任何电子邮件警报,以防出现任何问题,因此我通过从 WEBUI 发送自定义主机通知进行了测试,日志中似乎有些问题。我希望有人能帮助我。请查看以下日志:
从 Nagios Frontend Webui:(通过发送自定义主机通知进行测试)
Sep 24 20:43:00 ubuntubackup-chennai sendmail[5923]: q8OFD0bP005923: Authentication-Warning: localhost.localdomain: nagios set sender to nagiosub@****.com using -r
Sep 24 20:43:00 ubuntubackup-chennai sendmail[5923]: q8OFD0bP005923: from=nagiosub@****.com, size=436, class=0, nrcpts=1, msgid=<5060787c.cbQWUMyq0G8H5/8r%nagiosub@****.com>, relay=nagios@localhost
Sep 24 20:43:00 ubuntubackup-chennai sendmail[5924]: q8OFD0JV005924: <[email protected]>... User unknown
Sep 24 20:43:00 ubuntubackup-chennai sendmail[5923]: q8OFD0bP005923: to=$, ctladdr=nagiosub@****.com (496/492), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30436, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
Sep 24 20:43:00 ubuntubackup-chennai sendmail[5924]: q8OFD0JV005924: from=<nagiosub@****.com>, size=436, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 24 20:43:00 ubuntubackup-chennai sendmail[5923]: q8OFD0bP005923: q8OFD0bQ005923: DSN: User unknown
Sep 24 20:43:01 ubuntubackup-chennai sendmail[5924]: q8OFD0JX005924: from=<>, size=2374, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 24 20:43:01 ubuntubackup-chennai sendmail[5923]: q8OFD0bQ005923: to=nagiosub@****.com, delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=31460, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (q8OFD0JX005924 Message accepted for delivery)
Sep 24 20:43:02 ubuntubackup-chennai sendmail[5926]: q8OFD0JX005924: to=<nagiosub@****>, delay=00:00:02, xdelay=00:00:01, mailer=relay, pri=122374, relay=smtp10.netcore.co.in. [202.162.229.32], dsn=2.0.0, stat=Sent (_SMR_smtp12.netcore.co.in Ok: queued as 0797E19957)
以 Nagios 用户身份从终端执行:
Sep 24 20:44:04 ubuntubackup-chennai sendmail[6067]: q8OFE4Th006067: Authentication-Warning: localhost.localdomain: nagios set sender to nagiosub@****.com using -r
Sep 24 20:44:04 ubuntubackup-chennai sendmail[6067]: q8OFE4Th006067: from=nagiosub@****.com, size=341, class=0, nrcpts=1, msgid=<506078bc.5x+q5X78H8WjVw2J%nagiosub@****.com>, relay=nagios@localhost
Sep 24 20:44:04 ubuntubackup-chennai sendmail[6068]: q8OFE4WN006068: from=<nagiosub@****.com>, size=614, class=0, nrcpts=1, msgid=<506078bc.5x+q5X78H8WjVw2J%nagiosub@****>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 24 20:44:05 ubuntubackup-chennai sendmail[6067]: q8OFE4Th006067: to=karthick@****.com, ctladdr=nagiosub@**** (496/492), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30341, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (q8OFE4WN006068 Message accepted for delivery)
Sep 24 20:44:05 ubuntubackup-chennai sendmail[6070]: q8OFE4WN006068: to=<karthick@****.com>, delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=120614, relay=smtp10.netcore.co.in. [202.162.229.32], dsn=2.0.0, stat=Sent (_SMR_smtp9.netcore.co.in Ok: queued as 517CEF7E69)
以 Root 用户身份从终端执行:
Sep 24 20:44:56 ubuntubackup-chennai sendmail[6167]: q8OFEtSo006167: from=root, size=281, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
Sep 24 20:44:56 ubuntubackup-chennai sendmail[6168]: q8OFEuBX006168: from=<[email protected]>, size=555, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Sep 24 20:44:56 ubuntubackup-chennai sendmail[6167]: q8OFEtSo006167: to=karthick@****, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30281, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (q8OFEuBX006168 Message accepted for delivery)
Sep 24 20:44:56 ubuntubackup-chennai sendmail[6170]: q8OFEuBX006168: to=<karthick@****.com>, ctladdr=<[email protected]> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=120555, relay=smtp10.netcore.co.in. [202.162.229.32], dsn=2.0.0, stat=Sent (_SMR_smtp12.netcore.co.in Ok: queued as 727A519942)
笔记:
- 从 root 用户和 nagios 用户收到邮件,但不是从 Nagios WEBUI 收到邮件。
主机文件中的条目:/etc/hosts
127.0.0.1 localhost.localdomain localhost ubuntubackup
::1 localhost6.localdomain6 localhost6
答案1
问题似乎是$CONTACTEMAIL$
宏设置不正确。
备份/etc/nagios3/commands.cfg
文件,然后在您喜欢的编辑器中打开它,将所有实例替换为$CONTACTEMAIL$
([email protected]
所需的电子邮件)。然后重新启动 nagios、apache,并再次尝试自定义命令通知。
答案2
问题是您的主机名是 localhost.localdomain,它由 sendmail 命令行修复,但不是由 webui 修复。
要修复此问题,请更改系统的主机名。如果你不知道主机名存储在哪里,请执行以下操作:
cd /etc
grep localdomain