Ubuntu での Zabbix Postfix Gmail 通知

Ubuntu での Zabbix Postfix Gmail 通知

postfix(Gmailへのリレー)を使用してZabbix Gmail通知を完璧に構成する方法 実際にはこの設定はローカルマシンでは機能していますが、実際のサーバーでこれを実装しようとすると、電子メール通知が失敗し、管理>監査>アクションで次のエラーが表示されます。

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リレー構成を確認し、smtpポート25に接続しました。

telnet localhost 25

そして、ターミナルからメールを送信することもできます

mail -s "Test mail" [email protected]

以下は私のメディア設定であり、これは私のローカルマシンで動作している設定と同じです。

メールアドレスを入力

SMTP server: localhost
SMTP helo: localhost
SMTP email: zabbix@localhost

これが私の設定です。

/etc/ホスト:

127.0.0.1 localhost.localdomain localhost
<my-ip-here> station1.lab.mycompany.com station1

設定ファイル:

# 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

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 

実際のサーバーとローカル マシンの唯一の違いはホスト名です。

メディア設定をサーバーのドメイン名とホスト名に変更しようとしましたが、効果はありませんでした。

助けてください!

答え1

Zabbix メディア タイプ構成で電子メール サーバーを localhost ではなく 127.0.0.1 として構成してみてください。localhost が ::1 に解決され、zabbix_server が ipv6 サポートなしでコンパイルされている場合は、失敗する可能性があります。

答え2

https://gist.github.com/superdaigo/3754055 スクリプト内のログインパスワードを変更し、 に貼り付け/usr/lib/zabbix/alertscripts、+ ユーザーへの通知方法でスクリプトのフルネーム (拡張子) を追加します。

関連情報