zabbix发送邮件时报错:Couldn’t resolve host name: Could not resolve host: smtp.sina.com; Unknown error
查看日志如下:
[root@zabbix fonts]# tail -0f /var/log/zabbix/zabbix_server.log
124579:20220110:201032.525 failed to send email: Couldn't resolve host name: Could not resolve host: smtp.sina.com; Unknown error
解释:
124577:20220110:195730.530 发送邮件失败:无法解析主机名:无法解析主机:smtp.sina.com; 未知错误
解决思路:
我配置的是静态ip 只有一个本地网关作为DNS 于是ping 一下
ping smtp.sina.com
# 观察无法解析到IP
ping smtp.sina.com
ping: smtp.sina.com: Name or service not known
于是就配置一下DNS
DNS2=8.8.8.8
DNS3=114.114.114.114
# 再ping就可以了
ping smtp.sina.com
PING smtp.sina.com.cn (49.7.36.22) 56(84) bytes of data.
^C64 bytes from 49.7.36.22: icmp_seq=1 ttl=128 time=40.0 ms
最后测试完美为通过