Email アラート設定
概要
Pandora FMS has several notification mechanisms for the alert system and a fundamental pillar for this is the sending of e-mail messages.
Pandora FMS には アラートシステム 用の通知メカニズムがいくつかあり、その基本的な柱となるのが電子メールメッセージの送信です。
Before activating the email alerts, you should configure the parameters for the email in the Pandora FMS server through the Web Console.
電子メールアラートを有効にする前に、ウェブコンソールから Pandora FMS サーバの電子メールのパラメータを設定する 必要があります。
アクション設定
Management → Alerts → Actions → Mail to admin menu.
管理(Management) → アラート(Alerts) → アクション(Actions) → Mail to admin メニュー。
To configure the e-mail recipient(s), modify the Mail to admin action to which all alert e-mails will be sent. The addresses must be separated by commas:
電子メールの受信者を設定するには、すべてのアラート電子メールが送信される Mail to admin アクションを変更します。アドレスはカンマで区切る必要があります。
To finish, the action is saved by pressing the Update button.
最後に、更新(Update) ボタンを押してアクションを保存します。
アラート設定
Management → Alerts → List of alerts → Create menu.
管理(Management) → アラート(Alerts) → アラート一覧(List of alerts) → 作成(Create) メニュー。
You must first choose an agent and then a module which will be alerted by mail according to its status change. In the Actions list, select the Mail to admin option.
まずエージェントを選択し、次にステータスの変更に応じてメールで通知されるモジュールを選択する必要があります。アクション(Actions) リストで、Mail to admin オプションを選択します。
Finally, the alert is saved by pressing the Add alert button.
最後に、アラート追加(Add alert) ボタンを押してアラートを保存します。
(OBSOLETE)
Gmail アカウントを使った Email 設定
Gmail 経由でのアラートメール送信を Pandora FMS で設定するには、以下のように Pandora および Postfix を設定する必要があります。
Pandora 設定
Gmail アカウントを使用してメール送信を正しく設定するには、Pandora FMS サーバ設定ファイル(/etc/pandora/pandora_server.conf)で、mta_address 以外の以下のコメント行のすべての設定が必要です。mta_address は(postfixサーバーがインストールされている)サーバの IP アドレスもしくは localhost です。
Postfix が Pandora FMS と同じサーバにインストールされている場合は、pandora_server.conf の設定は以下のようになります。
mta_address localhost #mta_port 25 #mta_user myuser@mydomain.com #mta_pass mypassword #mta_auth LOGIN #mta_from Pandora FMS <pandora@mydomain.com>
Pandora FMS コンソールでアラートを設定する方法を簡単に見てみましょう。
アクション設定
アラート設定
この場合、モジュールの設定は、モジュール設定(module configuration) > アラート(Alerts) ファイルで行われています。以下のスクリーンショットではモジュールの新しいアラートが見られます。
アラートが発報されると、アラートがアクションに割り当てられたメールアドレスにどのように届くかを確認できます。
Postfix インストール
Gmail アカウントと共に postfix サーバが正しく動作するためには、Pandora サーバに以下のパッケージがインストールされている必要があります。
yum install postfix mailx cyrus-sasl-plain cyrus-sasl cyrus-sasl-lib cyrus-sasl-md5 cyrus-sasl-scram cyrus-sasl-gssapi
Postfix 設定
Postfix をインストールし、Gmail を通しての送信以外の動作が正しくできるようになったら、以下のステップを実施します。
1– Gmail アカウントで、“less secure pass” オプションが有効になっているか確認します。https://myaccount.google.com/lesssecureapps から有効化できます。
2– /etc/postfix/main.cf を編集し、以下の行を一番後ろに追加します。
myhostname = <hostname> #Add here server hostname relayhost = [smtp.gmail.com]:587 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_tls_policy_maps = hash:/etc/postfix/tls_policy smtp_sasl_security_options = noanonymous smtp_use_tls = yes smtp_tls_CAfile = /etc/pki/tls/cert.pem smtp_tls_security_level = encrypt
3– Gmail のアドレスとパスワードを設定する /etc/postfix/sasl_passwd ファイルを作成します。
nano /etc/postfix/sasl_passwd
ファイルには、Gmail のアドレスとパスワードを含む以下の行を追加します。
[smtp.gmail.com]:587 ACCOUNT@gmail.com:PASSWORD
パーミッションを調整します。
chmod 600 /etc/postfix/sasl_passwd chown root:root /etc/postfix/sasl_passwd
4– 次の内容で /etc/postfix/tls_policy ファイルを作成します。
nano /etc/postfix/tls_policy
[smtp.gmail.com]:587 encrypt
パーミッションを調整します。
chmod 600 /etc/postfix/tls_policy chown root:root /etc/postfix/tls_policy
5– 以下のコマンドで /etc/postfix/sasl_passwd および /etc/postfix/tls_policy のハッシュインデックスを作成します。
postmap /etc/postfix/sasl_passwd && postmap /etc/postfix/tls_policy
/etc/postfix/sasl_passwd.db および /etc/postfix/tls_policy.db ファイルが作成されます。
6– 最後に、postfix を再起動し変更を反映させます。
/etc/init.d/postfix restart
7– 2つのコンソールに入って動作確認します。以下のコマンドでメール送信の動作を確認します。
tail -f /var/log/maillog
もう一方のコンソールでメールを送信します。
echo "Mail test" | mail test@gmail.com
上記のステップが正しく実行されていれば、最初のコンソールには次のようなものが表示されるはずです。
Dec 18 18:33:40 OKComputer postfix/pickup[10945]: 75D4A243BD: uid=0 from= Dec 18 18:33:40 OKComputer postfix/cleanup[10951]: 75D4A243BD: message-id= Dec 18 18:33:40 OKComputer postfix/qmgr[10946]: 75D4A243BD: from=, size=403, nrcpt=1 (queue active) Dec 18 18:33:44 OKComputer postfix/smtp[10953]: 75D4A243BD: to=prueba@gmail.com, relay=smtp.gmail.com[74.125.93.109]:587, delay=3.7, delays=0.15/0.14/1.8/1.6, dsn=2.0.0, status=sent (250 2.0.0 OK 1324249500 eb5sm36008464qab.10) Dec 18 18:33:44 OKComputer postfix/qmgr[10946]: 75D4A243BD: removed
このような結果であれば、Pandora は Postfix サーバにメールを渡し、それらはうまく送られるでしょう。