Opsgenie を Zabbix プラグインと統合する
Opsgenie が Zabbix ユーザーに提供するもの
インテグレーションでは、Opsgenie の Zabbix 固有の実行可能ファイルと OEC ユーティリティを活用して、豊富なアラートを自動的に作成し、Zabbix と Opsgenie の間でアラート ステータスを同期します。Zabbix アラームは、Opsgenie でアラートが承認されると、自動的に承認されます。Opsgenie Zabbix プラグインを使用すると Opsgenie が提供する詳細な機能を Zabbix で利用できるようになるため、統合方法として推奨されます。
統合の機能性
ユーザーが Opsgenie アプリを使用してモバイル デバイスからアラートを確認する場合、そのアラートは Zabbix で確認されます。
インストール
以下の手順では、Opsgenie の Zabbix インテグレーション プラグインを使用して、Opsgenie と Zabbix を統合する方法を説明します。ご使用の Linux ディストリビューションと Zabbix 設定によっては、これらの手順に若干の変更が必要になる場合があることに注意してください。
前提条件
提供されるパッケージは、以下のシステムをサポートしています。
Red Hat ベースの Linux ディストリビューション
Debian ベースの Linux ディストリビューション
Opsgenie Zabbix プラグインのインストール
OEC の最新バージョンをダウンロードする
To download the latest version of Zabbix Plugin package, please use readme file of oec-scripts repository.
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>.rpmFor 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 プラグイン設定
プラグインは golang 実行可能ファイル (send2opsgenie としてプラグインに含まれます) を使用して、Opsgenie でアラートを作成、承認、クローズします。イベント時にこのファイルを実行するように Zabbix を設定して、Opsgenie でアラートを作成、承認、クローズします。
Configure an action via the Zabbix frontend, that executes /home/opsgenie/oec/opsgenie-zabbix/send2opsgenie when an event is triggered.
[アクション] で、[Recovery Message (リカバリ メッセージ)] チェックボックスを有効にして、アラートが Zabbix でクローズされたら、Opsgenie でそのアラートがクローズされるようにします。
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)
プラグインは golang 実行可能ファイル (send2opsgenie としてプラグインに含まれます) を使用して、Opsgenie でアラートを作成、承認、クローズします。イベント時にこのファイルを実行するように Zabbix を設定して、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
以下から選択してください:
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.txtinto 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 キー | さきほど作成した Zabbix 統合から API キーをコピーします。send2opsgenie はこのキーを使用して Opsgenie への認証を行います。アラートの処理に使用される適切な統合設定の識別にも API キーが使用されます。 | はい | /home/opsgenie/oec/conf/config.json |
ベース URL | Opsgenie を別のドメイン (例: EU、サンドボックス) は、この設定をアップデートする必要があります。Opsgenie Zabbix インテグレーションの [詳細設定] ページ。 | 任意 | /home/opsgenie/oec/conf/config.json |
responders | 対応者フィールドは、Zabbix アラートの通知先を指定するために使用されます。このフィールドは、既定の対応者フィールド値を設定するために使用されます。Opsgenie Zabbix インテグレーションの [詳細設定] ページで、異なる人およびチームに異なるアラートをルーティングするように受信者を変更できます。受信者は、Opsgenie から通知されるユーザー、グループ、エスカレーション、またはスケジュールに設定できます。インテグレーションで対応者を設定していない場合、このフィールドは必須です。統合で受信者を設定していない場合、このフィールドは必須です。 | 任意 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
tags | [Tags] フィールドは、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 |
注意: 特殊文字 (triggerUrl、ipAddress、date、time の各フィールドを除く) は、Opsgenie データが処理される前に Zabbix 受信ペイロードから削除されます。
追加のカスタム引数を送信する場合は、customArgName1 customArgValue1 customArgName2 customArgValue2 のようにフラグの後に追加できます。
入力フィールドの必要な場所に {{_payload.customArgName}} を追加することで、カスタム引数を解析できます。*
生のパラメーターの使用に関する詳細については、動的フィールドのドキュメントをご確認ください。
Opsgenie から Zabbix へのインテグレーションを設定する (オプション)
Opsgenie の OEC と Zabbix スクリプトを使用して、Zabbix でアラートを更新します。これによって、独自のスクリプトや機能をデプロイして提供された機能を変更し、カスタマイズしたアクションを Zabbix 上で実行できます。
Zabbix でアクションを実行できるようにするには、OEC で設定ファイルから設定パラメーターを取得します。設定ファイルは、/home/opsgenie/oec/conf/config.json にあります。
設定パラメーター | 説明 | 場所 |
|---|---|---|
command_url | Zabbix アラートを承認する Zabbix API エンドポイント。 | /home/opsgenie/oec/conf/config.json |
ユーザー | OEC が Zabbix への認証に使用したユーザー名。 | /home/opsgenie/oec/conf/config.json |
パスワード | OEC が 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 インテグレーション パッケージは SSL v1.0 をサポートしていません。Zabbix のサーバーで SSL v1.0 を使用している場合は、SSL サーバーをアップグレードすることをお勧めします。
よくある質問とトラブルシューティング
インテグレーションが適切に機能しない場合は、問題が以下に記載されていないかどうかを確認し、当社のアドバイスに従ってください。
1. Zabbix アラートが Opsgenie で作成されません
シェルから次のテスト コマンドを実行します。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 またはこのファイルにログがない場合は以下を確認してください。
まず、Zabbix ユーザーが /var/log/opsgenie ディレクトリへの書き込み権限を持っていることを確認します。これは、インストール パッケージによって自動で実行されます。問題が発生した場合は
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 アラームが承認されません
Check the Alerts logs.
"Posted [Acknowledge] action to Zabbix.." がログに含まれていない場合、これは、Opsgenie が承認アクションを Zabbix に送信しなかったことを意味します。統合設定を確認してください。アラート アクションと一致していない可能性があります。
"Posted [Acknowledge] action to Zabbix.." のみがログに記録され、それ以降関連ログがない場合、OEC に接続の問題が発生している可能性があります。ログを確認してください。
3. Zabbix RPM パッケージを開けません
Zabbix の rpm パッケージのインストール中に次のエラーが表示される場合:
テキスト
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 システム用にビルドされていることに注意してください。
この内容はお役に立ちましたか?