如何完美configurationzabbix gmail通知与Postfix(中继到Gmail)其实这个设置是在我的本地机器上工作,但是当我尝试在我的真实服务器上实现这个,电子邮件通知失败,我可以看到pipe理>审计中的以下错误>行动
Cannot connect to SMTP server [localhost] [gethost() failed for address 'localhost' [Success]]
我的“/var/log/mail.log”消息
Aug 26 00:14:31 station1 postfix/smtpd[9385]: connect from localhost.localdomain[127.0.0.1] Aug 26 00:14:31 station1 postfix/smtpd[9385]: disconnect from localhost.localdomain[127.0.0.1] Aug 26 00:15:31 station1 postfix/smtpd[9385]: connect from localhost.localdomain[127.0.0.1] Aug 26 00:15:31 station1 postfix/smtpd[9385]: disconnect from localhost.localdomain[127.0.0.1]
我用telnet命令查看了我的postfix gmail中继configuration,并连接到smtp端口25
telnet localhost 25
我甚至可以从terminal发送邮件
mail -s "Test mail" [email protected]
以下是我的媒体设置,这是在我的本地机器上工作的相同的设置
键入电子邮件
SMTP server: localhost SMTP helo: localhost SMTP email: zabbix@localhost
这是我的设置。
/ etc / hosts中:
127.0.0.1 localhost.localdomain localhost <my-ip-here> station1.lab.mycompany.com station1
/etc/zabbix/zabbix_agentd.conf:
# Default: # Server= Server=127.0.0.1 ### Option: Hostname # Unique, case sensitive hostname. # Required for active checks and must match hostname as configured on the server. # # Default: # Hostname=system.uname Hostname=Zabbix server ### Option: ListenPort # Agent will listen on this port for connections from the server. # # Mandatory: no # Range: 1024-32767 # Default: # ListenPort=10050
/etc/zabbix/zabbix_agent.conf:
# This is a config file for zabbix_agent # To get more information about Zabbix visit http://www.zabbix.com ### Option: Server # IP address of Zabbix server # Connections from other hosts will be denied # If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally. # # Mandatory: yes # Default: # Server= Server=127.0.0.1 ### Option: Timeout # Spend no more than Timeout seconds on processing # # Mandatory: no # Range: 1-30 # Default: # Timeout=3
主机名:
root@station1:~#hostname station1.lab.mycompany.com
我真正的服务器和我的本地机器唯一的区别是主机名。
我甚至尝试将我的媒体设置更改为我的服务器域名和主机名,但没有用。
请帮忙!
尝试在zabbix媒体typesconfiguration中将电子邮件服务器configuration为127.0.0.1,而不是localhost。 如果localhostparsing为:: 1且zabbix_server编译时没有ipv6支持,则可能会失败。
https://gist.github.com/superdaigo/3754055在脚本中更改login密码,粘在/usr/lib/zabbix/alertscripts ,在通知方法中将脚本的全名(扩展名)添加到+用户。