PDA

View Full Version : Zabbix gmail notification with postfix


Thyagaraj
27-08-2010, 15:26
How to perfectly configure zabbix gmail notification with postfix(relay to gmail)
Actually this setup is working on my local machine but when I try to implement this on my real servers, email notification is failed and I could see the following error in audit

Cannot connect to SMTP server [localhost] [gethost() failed for address 'localhost' [Success]]

my /var/log/mail.log message

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]


Thanks all!

mercy
30-08-2010, 13:07
Smtp server is runnig correctly?

try
telnet localhost 25
helo yourdomain
mail from: <>
rcpt to: <somemail@google.com>
data
Enter message here
.
exit

Thyagaraj
30-08-2010, 13:16
When I use telnet command on ubuntu, I'm getting following error:

-bash: /usr/bin/telnet: No such file or directory

Regarding this I posted in ubuntu forum and i'm asked to remove telnetd and install only telnet client(telnet). I did as it is said but no change with same problem as above.

mattsmith
31-08-2010, 10:52
This is a link that i used last week, we use postfix to relay mails to google on our ec2 servers.

http://ubuntu-tutorials.com/2008/11/11/relaying-postfix-smtp-via-smtpgmailcom/

Hope this helps
Matt

Thyagaraj
03-09-2010, 08:09
Now my smtp is working fine(checked telnet localhost 25) and I could send mail from command line like this 'mail -s "hello" mymailid@gmail.com. But i'm getting the same above posted error in the Audit>Actions.
This is my media settings and this is the same settings which is working on my local machine

Media
Description:
Type E-mail
SMTP server: localhost
SMTP helo: localhost
SMTP email: root@localhost

Thyagaraj
06-09-2010, 08:39
Zabbix E-mail notification error(audit->actions):

Cannot connect to SMTP server [localhost] [gethost() failed for address 'localhost' [Success]]

walterheck
07-09-2010, 03:01
You probably need to customise the helo name to a domain that is accepted by postfix. The actual hostname of the machine usually works. Besides that, it's better to change the SMTP email address to some address in your domain, like zabbix@mydomain.com

Thyagaraj
07-09-2010, 07:30
Is there any way so that I force zabbix to send email immediately?.

Thyagaraj
08-09-2010, 07:19
Here are my settings.


/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




Hostname:
root@station1:~#hostname
station1.lab.mycompany.com

Thyagaraj
13-09-2010, 06:30
Please anyone put an end to this issue.