Migrating to a new Zabbix server, from 3.4.6 to 4.0.2
Everything was working except for email notifications.
Nothing was going out, and email log (postfix) showed no activity.
Test emails from the command line worked fine.
Media was set to connect to localhost. I was seeing this repeated many times in the log file:
26726:20190106:031450.304 failed to send email: cannot connect to SMTP server "localhost": cannot connect to [[localhost]:25]: [111] Connection refused
26727:20190106:031450.304 failed to send email: cannot connect to SMTP server "localhost": cannot connect to [[localhost]:25]: [111] Connection refused
26728:20190106:031450.304 failed to send email: cannot connect to SMTP server "localhost": cannot connect to [[localhost]:25]: [111] Connection refused
and it finally dawned on me that it was trying to connect to an IPv6 localhost address.
When I replaced "localhost" with "127.0.0.1", everything started to work and Zabbix sent all the queued messages
Checking my /etc/hosts file, localhost is
:
Nslookup returns the following:
Dig returns the following:
There is no configuration option for IPv6 or IPv4.
I consider this to be a bug, since all other networking tools are working properly with localhost. At the very least, there should be some way to say whether it is an IPv4 or IPv6 address
This is a CentOS 7 box, with the following RPMs installed (from the official Zabbix repos):
Everything was working except for email notifications.
Nothing was going out, and email log (postfix) showed no activity.
Test emails from the command line worked fine.
Media was set to connect to localhost. I was seeing this repeated many times in the log file:
26726:20190106:031450.304 failed to send email: cannot connect to SMTP server "localhost": cannot connect to [[localhost]:25]: [111] Connection refused
26727:20190106:031450.304 failed to send email: cannot connect to SMTP server "localhost": cannot connect to [[localhost]:25]: [111] Connection refused
26728:20190106:031450.304 failed to send email: cannot connect to SMTP server "localhost": cannot connect to [[localhost]:25]: [111] Connection refused
and it finally dawned on me that it was trying to connect to an IPv6 localhost address.
When I replaced "localhost" with "127.0.0.1", everything started to work and Zabbix sent all the queued messages
Checking my /etc/hosts file, localhost is
:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
Nslookup returns the following:
]# nslookup
> localhost
Server: 172.30.0.2
Address: 172.30.0.2#53
Non-authoritative answer:
Name: localhost
Address: 127.0.0.1
> localhost
Server: 172.30.0.2
Address: 172.30.0.2#53
Non-authoritative answer:
Name: localhost
Address: 127.0.0.1
Dig returns the following:
# dig localhost
; <<>> DiG 9.9.4-RedHat-9.9.4-61.el7_5.1 <<>> localhost
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62101
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;localhost. IN A
;; ANSWER SECTION:
localhost. 900 IN A 127.0.0.1
;; Query time: 1 msec
;; SERVER: 172.30.0.2#53(172.30.0.2)
;; WHEN: Fri Jan 11 10:04:15 EST 2019
;; MSG SIZE rcvd: 43
; <<>> DiG 9.9.4-RedHat-9.9.4-61.el7_5.1 <<>> localhost
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62101
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;localhost. IN A
;; ANSWER SECTION:
localhost. 900 IN A 127.0.0.1
;; Query time: 1 msec
;; SERVER: 172.30.0.2#53(172.30.0.2)
;; WHEN: Fri Jan 11 10:04:15 EST 2019
;; MSG SIZE rcvd: 43
There is no configuration option for IPv6 or IPv4.
I consider this to be a bug, since all other networking tools are working properly with localhost. At the very least, there should be some way to say whether it is an IPv4 or IPv6 address
This is a CentOS 7 box, with the following RPMs installed (from the official Zabbix repos):
zabbix-release-4.0-1.el7.noarch
zabbix-web-pgsql-4.0.2-1.el7.noarch
zabbix-agent-4.0.2-1.el7.x86_64
zabbix-sender-4.0.1-1.el7.x86_64
zabbix-web-4.0.2-1.el7.noarch
zabbix-server-pgsql-4.0.2-1.el7.x86_64
zabbix-web-pgsql-4.0.2-1.el7.noarch
zabbix-agent-4.0.2-1.el7.x86_64
zabbix-sender-4.0.1-1.el7.x86_64
zabbix-web-4.0.2-1.el7.noarch
zabbix-server-pgsql-4.0.2-1.el7.x86_64