nagios 发送电子邮件需要什么?

nagios 发送电子邮件需要什么?

我已经在运行 ubuntu server 20.04 的 kvm 客户机中从 ubuntu 存储库包安装了 nagios4。我可以手动调用 sendmail 并发送电子邮件。但是 nagios 没有发送任何电子邮件。 /var/log/mail.log仅包含我手动调用的条目。 /var/log/nagios4/nagios.log包含许多条目表明 nagios 正在尝试发送电子邮件:

[1627148632] SERVICE NOTIFICATION: me;localhost;/dev/shm;UNKNOWN;notify-service-by-email;DISK UNKNOWN - free space:
[1627148662] wproc: Core Worker 28377: job 11764 (pid=211002) timed out. Killing it
[1627148663] wproc: NOTIFY job 11764 from worker Core Worker 28377 timed out after 31.05s
[1627148663] wproc:   host=localhost; service=/dev/shm; contact=me
[1627148663] wproc:   early_timeout=1; exited_ok=0; wait_status=0; error_code=62;
[1627148663] Warning: Notifying contact 'me' of service '/dev/shm' on host 'localhost' by command '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: PROBLEM\n\nService: /dev/shm\nHost: localhost\nAddress: 127.0.0* .1\nState: UNKNOWN\n\nDate/Time: Sat Jul 24 12:43:52 CDT 2021\n\nAdditional Info:\n\nDISK UNKNOWN - free space:\n"|/usr/bin/mail -s"** localhost /dev/shm UNKNOWN **" [email protected]' timed out after 0.00 seconds

当我发出上面最后一行显示的命令时,电子邮件就发送了。但是 nagios4 怎么了?为什么它不发送任何电子邮件?

附加信息:sendmail 显然要花或等待 60 秒才能发送每封电子邮件。而 nagios 显然会在 30 秒后超时。需要做什么才能修复这两个问题?

答案1

虽然问题看起来完全不同,但答案是一样的

http://digitalocean.com/community/questions/sendmail-is-slow-to-send-mail

就我而言,在更改 /etc/hosts 中的以下几行后,它工作正常:

127.0.0.1 localhost
127.0.1.1 myserver

127.0.0.1 myserver localhost localhost.localdomain
127.0.1.1 myserver localhost localhost.localdomain

相关内容