Opsgenie を Zabbix プラグインと統合する
Opsgenie が Zabbix ユーザーに提供するもの
Integration leverages Opsgenie’s Zabbix-specific executable and OEC utility to automatically create rich alerts and synchronize alert status between Zabbix and Opsgenie. Zabbix alarms are acknowledged automatically when the alert is acknowledged in Opsgenie. Opsgenie Zabbix plugin is the recommended integration method as it enables Zabbix to take advantage of advanced capabilities provided by Opsgenie.
統合の機能性
When users acknowledge an alert from their mobile devices using the Opsgenie app, the alert is acknowledged in Zabbix.
インストール
The steps below describe how to integrate Opsgenie and Zabbix using the Opsgenie Zabbix integration plugin. Note that these instructions may need slight alteration depending on the exact Linux distribution and the Zabbix configuration.
前提条件
提供されるパッケージは、以下のシステムをサポートしています。
Red Hat ベースの Linux ディストリビューション
Debian ベースの Linux ディストリビューション
Opsgenie Zabbix プラグインのインストール
OEC の最新バージョンをダウンロードする
Zabbix プラグイン パッケージの最新バージョンをダウンロードするには、oec-scripts リポジトリの readme ファイルを使用してください。
RedHat ベースのディストリビューションの場合
Get the rpm package corresponding to the RedHat version you are using:
If running RedHat Enterprise Linux 6 (or variants), get:
opsgenie-zabbix-<your_version>.rhel6.<architecture>.rpm
For newer versions of RedHat, get:
opsgenie-zabbix-<your_version>.<architecture>.rpm
After downloading, run the following command: rpm -i <downloaded_package>.rpm
アップグレード中、rpm パッケージは既存の設定を上書きしません。これによって、新しい既定の設定ファイルが opsgenie-integration.conf.rpmnew として保存されます。rpm アップグレード設定ファイルの処理の詳細については、こちらをご参照ください。
バージョン 201X-XX-XX から2.X.X にアップデートする場合は、--force パラメーターを追加する必要があります。
例:
rpm -U --force opsgenie-integration-<your_version>.rpm
アップデートする前に、設定ファイルをアップデートすることをお勧めします。
Debian ベースのディストリビューションの場合
次のコマンドを実行します。
dpkg -i opsgenie-zabbix-<your_version>_<architecture>.deb
Opsgenie で Zabbix インテグレーションを追加する
Opsgenie の Free プランまたは Essentials プランを使用している、または Jira Service Management の Standard プランで Opsgenie を使用している場合は、チーム ダッシュボードからのみこの統合を追加できます。 このプランでは、[設定] の [統合] ページが利用できません。
[チーム] に移動して自分のチームを選択します。
左側のナビゲーションで [統合] を選択し、[統合を追加] を選択します。
統合をチーム ダッシュボードから追加すると、そのチーム統合の所有者になります。Opsgenie では、この統合を通じて受信したアラートはそのチームのみに割り当てられます。このセクションの残りの手順に従って、統合を設定してください。
Go to Settings > Integrations. Search for Zabbix and select Add.
Select Save Integration to save the integration. This will generate an API key for the integration. This key will be used by Zabbix to authenticate Opsgenie and specify the integration that should be used to process Zabbix alerts.
Zabbix (Zabbix バージョン 3.0 以下) での Opsgenie プラグイン設定
The plugin uses a golang-executable file (included in the plugin as send2opsgenie) to create, acknowledge, and close alerts in Opsgenie. Configure Zabbix to execute this file on events to create, acknowledge, and close alerts in Opsgenie.
Configure an action via the Zabbix frontend, that executes /home/opsgenie/oec/opsgenie-zabbix/send2opsgenie when an event is triggered.
Under Actions enable "Recovery Message" checkbox for closing the alert on Opsgenie when an alert is closed on Zabbix.
Under Operations, define a Remote Command that executes on Zabbix server. Paste the command in */home/opsgenie/oec/opsgenie-zabbix/actionCommand.txt into Command.
[Add (追加)]、[Save (保存)] の順にクリックします。
Check Configure send2opsgenie
Opsgenie Plugin Configuration in Zabbix (for Zabbix version 3.2 to 6.2)
The plugin uses a golang-executable file (included in the plugin as send2opsgenie) to create, acknowledge, and close alerts in Opsgenie. Configure Zabbix to execute this file on events to create, acknowledge, and close alerts in Opsgenie.
Configure an action via the Zabbix frontend, that executes */home/opsgenie/oec/opsgenie-zabbix/send2opsgenie when an event is triggered.
[設定] -> [アクション]、[Create New Action (新規アクションの作成)] の順に選択します。
[Actions (アクション)] で [Operations (実行内容)] を選択します。
Under Operations, define a Remote Command that executes on Zabbix server. Paste the command in */home/opsgenie/oec/opsgenie-zabbix/actionCommand.txtinto Command.
[Actions (アクション)] で [Recovery Operations (復旧時の実行内容)] を選択します。
Under Recovery Operations, define a Remote Command that executes on Zabbix server. Paste the command in */home/opsgenie/oec/opsgenie-zabbix/actionCommand.txt into Command.
[Add (追加)]、[Save (保存)] の順にクリックします。
Check Configure send2opsgenie
Opsgenie Plugin Configuration in Zabbix (for Zabbix version 6.4 and above)
The plugin uses a golang-executable file (included in the plugin as send2opsgenie) to create, acknowledge, and close alerts in Jira Service Management. Configure Zabbix to execute this file on events to create, acknowledge, and close alerts in Jira Service Management.
For new installations starting with Zabbix 7.0, global script execution is set to disabled
by default. To enable, set EnableGlobalScripts
from 0
to 1
in your Zabbix server configuration file (typically found in /etc/zabbix/zabbix_server.conf
) and restart your Zabbix instance.
Configure an action via the Zabbix frontend, that executes */home/opsgenie/oec/opsgenie-zabbix/send2opsgenie when an event is triggered.
From the navigation menu, select Alerts > Scripts then select Create Script
Choose:
A user defined identifier as Name
Action Operation as Scope,
Script as Type
Zabbix Proxy or Server as Execute on
Paste the command stored in
/home/opsgenie/oec/opsgenie-zabbix/actionCommand.txt
into Commands.
[追加] を選択します。
From the navigation menu, select Alerts > Actions > Trigger Actions then select Create Action.
Fill the action settings as you please, then switch to the Operations tab.
Under Operations, select Add in the Operations table.
For Operation, select the script you created in Step 4 from the dropdown menu.
From Target List, check the box for Current Host.
追加 を選択します 。
Repeat the steps 7 through 10 for the Recovery Operations and Update Operations tables.
追加 を選択します 。
Check Configure send2opsgenie
Configure send2opsgenie
send2opsgenie を動作させるには、いくつかの設定を行う必要があります。以下の表は、パラメーター、パラメーターが配置されている場所、およびそれらが必須であるかどうかを示しています。
設定パラメーター | 説明 | 入力必須 | 場所 |
---|---|---|---|
API キー | Copy the API key from the Zabbix integration you've created above. send2opsgenie uses this key to authenticate to Opsgenie. API key is also used to identify the right integration configuration that should be used to process alerts. | はい | /home/opsgenie/oec/conf/config.json |
ベース URL | If you're using Opsgenie from another domain(eg. EU, sandbox), you should update this configuration.Opsgenie Zabbix integration, Advanced Settings page. | 任意 | /home/opsgenie/oec/conf/config.json |
responders | Responders field is used to specify who should be notified for the Zabbix alerts. This field is used to set the default responders field value. The recipients can be modified to route different alerts to different people and teams in Opsgenie Zabbix integration, Advanced Settings page. Recipients can be set to users, groups, escalations or schedules who will be notified by Opsgenie. If you did not set responders in the integration, this field is required.schedules who will be notified by Opsgenie. If you did not set recipients in the integration, this field is required. | 任意 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
tags | Tags field is used to specify the tags of the alert that created in Opsgenie. | 任意 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
logPath | ログ ファイルの完全なパスを指定します (既定値は /var/log/opsgenie/send2opsgenie.log)。 | 任意 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
zabbix2opsgenie.http.proxy.enabled | zabbix2opsgenie.http.proxy.enabled フィールドは、外部プロキシの設定を有効または無効にします。既定値は false です。 | 任意 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
zabbix2opsgenie.http.proxy.host | これは、プロキシのホストです。 | 任意 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
zabbix2opsgenie.http.proxy.port | プロキシのポートです。 | 任意 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
zabbix2opsgenie.http.proxy.scheme | これは、プロキシ接続プロトコルです。プロキシ サーバーによって、http または https になる場合があります。既定値は http です。 | 任意 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
zabbix2opsgenie.http.proxy.username | プロキシ認証ユーザー名です。 | 任意 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
zabbix2opsgenie.http.proxy.password | これは、プロキシ認証パスワードです。 | 任意 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
Please note: Special characters (except triggerUrl, ipAddress, date, and time fields) will be removed from Zabbix incoming payload before data is processed in Opsgenie.
追加のカスタム引数を送信する場合は、customArgName1 customArgValue1 customArgName2 customArgValue2 のようにフラグの後に追加できます。
入力フィールドの必要な場所に {{_payload.customArgName}}
を追加することで、カスタム引数を解析できます。*
生のパラメーターの使用に関する詳細については、動的フィールドのドキュメントをご確認ください。
Opsgenie から Zabbix へのインテグレーションを設定する (オプション)
Use Opsgenie’s OEC and the Zabbix script to update alerts on Zabbix. This enables deployment of your own scripts/ability to modify the ones provided and execute customized actions on Zabbix.
To be able to execute actions in Zabbix, OEC gets the configuration parameters from the configuration file. The configuration file can be found under /home/opsgenie/oec/conf/config.json
設定パラメーター | 説明 | 場所 |
---|---|---|
command_url | The Zabbix API endpoint to acknowledge Zabbix alerts. | /home/opsgenie/oec/conf/config.json |
ユーザー | The username that OEC used to authenticate to Zabbix. | /home/opsgenie/oec/conf/config.json |
パスワード | The password that OEC uses to authenticate to Zabbix. | /home/opsgenie/oec/conf/config.json |
filePath | The script OEC uses to execute actions on Zabbix. Change to the value matching with your Zabbix version:
| /home/opsgenie/oec/conf/config.json |
ダウンロードしたパッケージには、/usr/local/bin にある OEC ユーティリティと、/home/opsgenie/oec/scripts にある OEC によって実行する必要があるスクリプトも含まれています。OEC の構成が完了したら、OEC を実行する必要があります。OEC の実行方法の詳細については、OEC の実行に関するドキュメントを参照してください。
Zabbix integration package does not support SSL v1.0. If your Zabbix Server has SSL v1.0, we suggest you to upgrade your SSL server.
よくある質問とトラブルシューティング
インテグレーションが適切に機能しない場合は、問題が以下に記載されていないかどうかを確認し、当社のアドバイスに従ってください。
1. Zabbix アラートが Opsgenie で作成されません
Run the following test command from the shell. Check if the test alert is created in Opsgenie:
テキスト
/home/opsgenie/oec/opsgenie-zabbix/send2opsgenie -triggerName='zabbix test alert' -triggerStatus='PROBLEM'
"Trace/breakpoint trap (トレース/ブレークポイント トラップ)" エラーが発生した場合: send2opsgenie プラグインにサーバー ディストリビューションとの互換性がないことを意味します。以下の「send2opsgenie のソースと再コンパイル」セクションに従い、特定のサーバー環境に従って send2opsgenie.go を再構築します。
If the alert is created in Opsgenie: It means the integration is installed correctly. The problem might be that Zabbix is not executing the command.
そうでない場合: /var/log/opsgenie/send2opsgenie.log のログを確認してください。ログ ファイルから次のエラーを探します。
If "RestException[Could not authenticate.]" error occurs in the logs, it means Opsgenie couldn't identify the api key. Check if the API key is set correctly, as explained in "Opsgenie Plugin Configuration in Zabbix" above.
問題がはっきりしない場合は、プラグインのログ レベルをデバッグに設定してもう一度お試しいただき、お問い合わせフォームでログを送信してください。
/var/log/opsgenie/send2opsgenie.log またはこのファイルにログがない場合は以下を確認してください。
First, make sure the Zabbix user has permission to write to /var/log/opsgenie directory. The installation package should automatically do this. If problems occur, execute:
chown -R zabbix:opsgenie /var/log/opsgenie.
Now check the Zabbix server logs at /var/log/zabbix/zabbix_server.log. See if there are error logs regarding send2opsgenie, and contact us with them.
send2opsgenie プラグインのログ レベルをデバッグに設定:
zabbix2opsgenie.logger=warning の行を zabbix2opsgenie.logger=debug に変更します (/home/opsgenie/oec/conf/opsgenie-integration.conf ファイル内)。
2. Opsgenie でアラートを承認しても Zabbix アラームが承認されません
アラート ログを確認します。
If the "Posted [Acknowledge] action to Zabbix.." log does not appear, it means Opsgenie didn't send the Acknowledge action to Zabbix. Check the integration configuration, it might not have matched the alert action.
"Posted [Acknowledge] action to Zabbix.." のみがログに記録され、それ以降関連ログがない場合、OEC に接続の問題が発生している可能性があります。ログを確認してください。
3. Zabbix RPM パッケージを開けません
If while installing Zabbix's rpm package you get the following error:
テキスト
zabbix is obsoleted by (installed) zabbix-server-pgsql-4.0.13-1.el7.x86_64
zabbix is obsoleted by (installed) zabbix-agent-4.0.13-1.el7.x86_64
zabbix is obsoleted by (installed) zabbix-java-gateway-4.0.13-1.el7.x86_64
代わりに "rpm -i opsgenie-zabbix-1.0.4-rpm-x86-64.rpm --nodeps" を使用する必要があります。
"is already installed (インストール済み)" エラーが表示された場合は、代わりに "rpm -i opsgenie-zabbix-1.0.4-rpm-x86-64.rpm --force" を使用してください。
send2opsgenie のソースと再コンパイル
実行可能な send2opsgenie のソースである send2opsgenie.go は /home/opsgenie/oec/opsgenie-zabbix の下にあり、GitHub Opsgenie Integration リポジトリでも入手できます。実行可能ファイルの動作を変更するには、send2opsgenie.go を編集し、以下を使用してビルドします。
go build send2opsgenie.go
go のインストールについては、http://golang.org/doc/install を参照してください。プラグインの実行可能ファイルは linux/386 システム用に構築されていることに注意してください。
この内容はお役に立ちましたか?