zabbix监控系列(4)之zabbix报警邮件无法发送
情况介绍
首先确保邮箱规则没有把报警邮件作为垃圾邮件拉黑了。
服务器断电重启后,发现zabbix报警邮件无法发送,断电之前是好好的,但是重启后不行了,于是查看maillog日志,发现这个错误: Host found but no data record of requested type。
[root@zabbixminitor ~]# tail /var/log/maillog
Nov 14 19:52:05 zabbixminitor postfix/pickup[3914]: 72A482125: uid=0 from=<root>
Nov 14 19:52:05 zabbixminitor postfix/cleanup[4458]: 72A482125: message-id=<20161114115205.72A482125@zabbixminitor.com>
Nov 14 19:52:05 zabbixminitor postfix/qmgr[1406]: 72A482125: from=<root@zabbixminitor.com>, size=439, nrcpt=1 (queue active)
Nov 14 19:52:05 zabbixminitor postfix/smtp[4402]: 72A482125: to=<liaojiafa@xxxs.com>, relay=none, delay=0, delays=0/0/0/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=xxxs.com type=AAAA: Host found but no data record of requested type)
Nov 14 19:52:05 zabbixminitor postfix/cleanup[4400]: 73D6C2126: message-id=<20161114115205.73D6C2126@zabbixminitor.com>
Nov 14 19:52:05 zabbixminitor postfix/bounce[4460]: 72A482125: sender non-delivery notification: 73D6C2126
Nov 14 19:52:05 zabbixminitor postfix/qmgr[1406]: 72A482125: removed
Nov 14 19:52:05 zabbixminitor postfix/qmgr[1406]: 73D6C2126: from=<>, size=2407, nrcpt=1 (queue active)
Nov 14 19:52:05 zabbixminitor postfix/local[4407]: 73D6C2126: to=<root@zabbixmonitor.com>, relay=local, delay=0.03, delays=0/0/0/0.02, dsn=2.0.0, status=sent (delivered to mailbox)
Nov 14 19:52:05 zabbixminitor postfix/qmgr[1406]: 73D6C2126: removed
,毫无疑问,邮箱域名解析出错导致无法发送邮件。那么就登陆到zabbix服务器上验证下这个问题:
[root@zabbixminitor ~]# nslookup
> server 172.16.160.9 # 公司内网地址,重启后DNS为自动获取,是内网的DNS
Default server: 172.16.160.9
Address: 172.16.160.9#53
> set type=mx # 设置为mx邮箱记录
> xxxs.com
Server: 172.16.160.9
Address: 172.16.160.9#53
*** Can't find xxxs.com: No answer # 不能够解析MX地址,所以邮件发送不出去
> server 114.114.114.114 # 更改DNS服务器
Default server: 114.114.114.114
Address: 114.114.114.114#53
> xxxs.com # 解析正常
Server: 114.114.114.114
Address: 114.114.114.114#53
Non-authoritative answer:
xxxs.com mail exchanger = 10 mxbiz2.qq.com.
xxxs.com mail exchanger = 5 mxbiz1.qq.com.
Authoritative answers can be found from:
xxxs.com nameserver = dns14.hichina.com.
xxxs.com nameserver = dns13.hichina.com.
dns13.hichina.com internet address = 140.205.228.14
dns13.hichina.com internet address = 42.120.221.14
dns13.hichina.com internet address = 140.205.81.14
dns14.hichina.com internet address = 42.120.221.24
dns14.hichina.com internet address = 140.205.81.24
dns14.hichina.com internet address = 140.205.228.24
问题找到后,那么就修改/etc/resolv.conf下的DNS地址即可,这回就可以发送邮件了 。
有问题请联系我,18500777133@sina.cn