Icinga 2 と統合する
統合でできるようになること
Icinga 2 統合プラグインでは、Jira Service Management の全機能を活用することで Icinga 2 との双方向の統合を実現します。
統合による機能
Icinga 2 からは、詳細情報が記載されたアラートが Jira Service Management に送信されます。Jira Service Management は Icinga 2 のアラートのディスパッチャーとして機能し、オンコール スケジュールに基づいて通知する適切な担当者を決定します。メール、電話、テキスト メッセージ (SMS)、iPhone や Android のプッシュ通知による通知を行い、アラートが承認またはクローズされるまでアラートをエスカレーションします。
Jira Service Management automatically connects to Icinga 2, gets performance data from Graphite for the host/service, and attaches it to the alert.
Jira Service Management によってアラートの最新情報が Icinga 2 にポストされます。たとえば、アラートを承認すると自動的にアラートが Icinga 2 で承認され、アラートのコメントが Icinga 2 に反映されます。
統合をセットアップする
Icinga 2 統合プラグインは、Jira Service Management の全機能を活用することで Icinga 2 との双方向の統合を実現します。以下の手順では、Icinga 2 統合プラグインを使用して Jira Service Management と Icinga 2 を統合する方法について説明しています。ご使用の Linux ディストリビューションと Icinga 2 の設定によっては、これらの手順に若干の変更が必要になる場合があることに注意してください。
インストールの必須条件
インストール パッケージは、以下のシステムをサポートしています。
RedHat ベースの Linux ディストリビューション
Debian ベースの Linux ディストリビューション
Icinga 2 用 Jira Service Management プラグインをインストールする
Jira Edge Connector (JEC) is a prerequisite for configuring the outgoing authentication of Icinga 2 integration. You can combinedly use JEC and Icinga 2 scripts to update alerts on Icinga 2. With this setup, you can deploy your script, modify the ones provided, or run customized actions on Icinga 2. Download the latest version of the Icinga 2 package.
RedHat ベースのディストリビューションに関する手順
次のコマンドを実行します。
rpm -i jsm-icinga2-<your_version>.rpm
The rpm package does not overwrite the existing configuration during upgrades. It saves the new default configuration file as integration.conf.rpmnew. Read more about config file handling for rpm upgrades.
バージョン 1 から統合をアップデートする場合は、integration.conf ファイルを次のようにアップデートします。
icinga.alert_histogram_image_url、icinga.trends_image_url、icinga.command_url の各プロパティを削除します。
icinga.api_url (Icinga サーバーの Icinga2 API エンドポイント) と icinga.graphite_url の各プロパティを追加します。
Debian ベースのディストリビューションに関する手順
次のコマンドを実行します。
dpkg -i jsm-icinga2-<your_version>.deb
その他のディストリビューションに関する手順
次のコマンドを実行します。
unzip jsm-icinga2-<your_version>.zip
Icinga 2 統合を追加する
The following capabilities are available in Jira Service Management Premium and Enterprise:
双方向の統合
Outgoing integrations at the team level
Integrations at a site level through Settings (icon) > Products (under Jira settings) > Operations
To access Jira Service Management Premium features, you must subscribe to a Service Collection Premium or Enterprise plan.
Adding an integration from your team’s operations page makes your team the owner of the integration. This means Jira Service Management only assigns the alerts received through this integration to your team.
Jira Service Management で Icinga 2 統合を追加するには、次の手順を実行します。
Next to Operations in the sidebar, select More actions (), then General configuration.
Select Integrations and then Add integration.
検索を実行して「Icinga 2」を選択します。
次の画面で、統合の名前を入力します。
オプション: 特定のチームが統合からのアラートを受信するようにする場合は、[Assignee team (担当者チーム)] のチームを選択します。
[Continue] を選択します。
この時点で、統合が保存されます。「統合を設定する手順」セクションを展開して、統合 URL をコピーします。
この URL は、後ほど Icinga 2 で統合を設定する際に使用します。Icinga 2 は API キーを使用して Jira Service Management を認証し、Icinga 2 のアラートを処理するための統合を指定します。[統合をオンにする] を選択します。
統合のために作成したルールは、統合をオンにした場合にのみ機能します。
Icinga 2 で Jira Service Management プラグインを設定する
プラグインは golang 実行可能ファイル (send2jsm としてプラグインに含まれます) を使用して、Jira Service Management でアラートを作成、承認、クローズします。Jira Service Management でアラートを作成、承認、クローズするために、イベントでこのファイルを実行するように Icinga 2 を設定します。apiKey の設定は必須です。その他の設定パラメーターは、ほとんどの Icinga 2 実装で動作する既定値に設定されていますが、変更が必要となる場合もあります。次の表は、パラメーターと、それらが必須かどうかの状態を示しています。
設定パラメーター
設定パラメーター | 説明 | 必須であるかどうか | 場所 |
|---|---|---|---|
API キー | Jira Service Management の統合設定ページから URL をコピーします。send2jsm は、このキーを使用して Jira Service Management への認証を行います。API キーは、アラートの処理に使用する必要がある適切な統合構成を識別するためにも用いられます。 | はい | /home/jsm/jec/conf/jec-config.json |
ベース URL | ご利用の Jira Service Management 環境(例:EU、サンドボックス)に応じて、このフィールドを変更してください。 | いいえ | /home/jsm/jec/conf/jec-config.json |
responders | 既定の対応者。このフィールドは、Icinga 2 のアラートを通知する必要がある対応者を指定するために使用されます。Jira Service Management でアラートを別のチームやスケジュールにルーティングするように変更できます。統合設定ページで対応者を設定していない場合、このフィールドは必須です。 | いいえ | /home/jsm/jec/conf/integration.conf |
tags | Jira Service Management で作成されたアラートのタグ。 | いいえ | /home/jsm/jec/conf/integration.conf |
icinga_server | Jira Service Management の Icinga 2 サーバー。複数の Icinga 2 サーバーがある場合にのみ必要です。これは、Jira Service Management がユーザーによって実行されたアクション (確認、終了など) を JEC 経由で Icinga 2 サーバーに送り返すときに使用されます。 | いいえ | /home/jsm/jec/conf/integration.conf |
logPath | ログ・ファイルの完全なパス (既定: /var/log/jec/send2jsm.log) | いいえ | /home/jsm/jec/conf/integration.conf |
icinga2jsm.http.proxy.enabled | 外部プロキシ設定を有効化/無効化します。既定:false | いいえ | /home/jsm/jec/conf/integration.conf |
icinga2jsm.http.proxy.host | プロキシのホスト | いいえ | /home/jsm/jec/conf/integration.conf |
icinga2jsm.http.proxy.port | プロキシのポート | いいえ | /home/jsm/jec/conf/integration.conf |
icinga2jsm.http.proxy.scheme | プロキシ接続プロトコル。プロキシ・サーバーによって、http または https になる場合があります。既定:http | いいえ | /home/jsm/jec/conf/integration.conf |
icinga2jsm.http.proxy.username | プロキシ認証用のユーザー名 | いいえ | /home/jsm/jec/conf/integration.conf |
icinga2jsm.http.proxy.password | プロキシ認証のパスワード | いいえ | /home/jsm/jec/conf/integration.conf |
golang 実行可能ファイルを次の 3 つの方法のいずれかで設定します。
方法 1: conf ファイルから設定する
/home/jsm/jec/conf/integration.conf ファイルから設定します。これによって、過去にスクリプトで行った設定がすべて上書きされます。
方法 2: Golang フラグで設定する
/etc/icinga2/features-available/jsm.conf ファイルのコマンド定義にフラグを入力して設定します。apiKey に -apiKey フラグを、icinga_server の名前に -is フラグを使用します。複数の Icinga 2 サーバーを使用していない場合は、Icinga 2 サーバーを定義する必要はありません。フラグを使用すると、上述したその他のすべての設定方法が上書きされます。
追加のカスタム引数を送信するには、arguments ディクショナリでキーと値のペアとして定義します。Icinga 2 は引数をシャッフルするため、order プロパティでカスタム引数がリストの最後に配置されるようにします。例:
"-spd" = "$service.perfdata$"
"customargument1" = {
value = "$customargument1$"
order = 1
}Parse custom arguments by adding {{_payload.customArgName}} to the input fields as needed.
Read more about dynamic properties.
方法 3: スクリプトから設定する
send2jsm.go スクリプトから apiKey と icinga_server を設定します。スクリプトを再構築して、新しい実行可能ファイルを /home/jsm/jec/scripts ディレクトリに追加します。send2jsm.go の場所と go スクリプトの構築方法は、「ソース」セクションを参照してください。
HTTP_PROXY=http://host:port 環境変数を定義して、HTTP リクエストの送信にプロキシを使用するよう golang 実行可能ファイルを設定します。
Icinga 連絡先を定義する
使用可能な Icinga 機能として /home/jsm/jec/conf/jsm.conf をコピーします。
シェル
cp /home/jsm/jec/conf/jsm.conf /etc/icinga2/features-available/jsm.conf2. jsm を有効にして、Icinga 2 を再起動します。
シェル
icinga2 feature enable jsm
3. Icinga を再起動します。
systemctl restart icinga2特に問題がない場合は、Icinga 2 で作成されたすべての通知について Jira Service Management にアラートが表示されます。
省略可: Icinga 2 をアップデートするように Jira Service Management を設定する
統合設定ページの [Icinga 2 にアラート アクションを送信] チェックボックスを選択します。JEC と Icinga 2 のスクリプトを組み合わせて使用し、Icinga 2 のアラートをアップデートできます。このセットアップにより、Icinga 2 上で独自のスクリプトをデプロイしたり、提供されたスクリプトを変更したり、カスタマイズしたアクションを実行したりできます。
Icinga 2 でアクションを実行するために、JEC は設定ファイル config.json (/home/jsm/jec/conf/jec-config.json にあります) から設定パラメーターを取得します。
設定パラメーター
api_url: JEC は、この URL を使用して、アラートの承認やコメントなどのアラートのアップデートを Icinga 2 に送信します。「https://localhost:5665」をご利用の Icinga 2 サーバーの API エンドポイントに置き換えてください。
graphite_url (optional): JEC retrieves performance data graphs from Icinga 2 using this URL. Replace the "http://localhost:5003" with the Graphite endpoint of your Icinga 2 server.
user: Icinga 2 API を認証するためのユーザー名。
password: Icinga 2 API を認証するためのパスワード。
http.timeout: Icinga 2 API に接続するためのタイムアウト時間 (ミリ秒単位)。
expire_acknowledgement_after: 指定された時間 (分単位) が経過したら、承認を削除します。既定で無効となっています。
insecure: Icinga 2 サーバーの API エンドポイントにアクセスする際に、SSL 認証を無視します。
The downloaded package includes the JEC utility (found in /usr/local/bin) and the script that JEC needs to run (found in /home/jsm/jec/scripts). Be sure to run JEC after configuring it. Find out how to run JEC.
Icinga 2 統合パッケージは SSL v1.0 をサポートしていません。Icinga 2 サーバーで SSL v1.0 を使用している場合は、SSL サーバーをアップグレードしてください。
send2jsm のソースと再コンパイル
The source for the executable send2jsm is found in /usr/bin/ and send2jsm.go, in /home/jsm/jec/scripts, respectively. You can also download them from the repository. To change the behavior of the executable, edit send2jsm.go and build it by using the following command: go build send2jsm.go. Find out how to install go. The executable in the plugin is built for linux/386 systems.
よくある質問とトラブルシューティング
統合が機能しない場合は、このセクションを確認して、規定のガイドラインに従ってください。
1. Jira Service Management で Icinga アラートが作成されない
シェルから次のテスト・コマンドを実行して、Jira Service Management でテスト・アラートが作成されているかどうかを確認します。
/home/jsm/jec/scripts/send2jsm -entityType=host -t=PROBLEM -hs=DOWN -hn=test_host
「Trace/breakpoint trap(トレース/ブレークポイント・トラップ)」エラーが発生した場合は、send2jsm プラグインとサーバー・ディストリビューションとの互換性がありません。この記事の「send2jsm のソースと再コンパイル」セクションでの説明のとおり、特定のサーバー環境に従って send2jsm.go を再構築してください。
アラートが Jira Service Management で作成されている場合、統合は正しく設定されています。Icinga 2 が Jira Service Management の連絡先にアラートを通知していないことが考えられます。Icinga 2 アラートの通知ログを確認してください。
Jira Service Management でアラートが作成されていない場合は、/var/log/jec/send2jsm.log のログをご確認ください。
ログファイルから次のエラーを探します。「RestException[Could not authenticate.] (RestException[認証できませんでした。])」がログに表示されている場合、Jira Service Management は API キーを識別できませんでした。この記事の「Icinga 2 で Jira Service Management プラグインを設定する」セクションに記載されているステップに従って、API キーが正しく設定されているか確認してください。
「[Icinga2] 統合の apiKey でこのアクションを実行できませんでした」エラーがログにある場合は、間違った統合パッケージをダウンロードしている可能性があります。正しい Icinga 2 統合パッケージをダウンロードしているか、ご確認ください。
If unsure of the problem, set the plugin's log level to debug and try again. Contact us and share the logs.
/var/log/jec/send2jsm.log ファイルがない場合、またはログがない場合は、次をご確認ください。
Icinga ユーザーに /var/log/jec ディレクトリへの書き込み権限があるかどうかを確認します。インストール・パッケージによって自動で実行されるはずです。問題が発生した場合は、次のコマンドを実行してください。
chown -R icinga:jsm /var/log/jecCheck the Icinga 2 server logs at /var/log/icinga2/icinga2.log. See if there are error logs regarding
send2jsm. Contact us with the logs as needed.
send2jsm プラグインのログ レベルを DEBUG に設定する
send2jsm プラグインのログレベルを DEBUG に設定します。/home/jsm/jec/conf/integration.conf ファイルを開いて、send2jsm.logger=warning 行を icinga2jsm.logger=debug に変更します。
2. Jira Service Management でアラートを承認しても、Icinga 2 アラートが承認されない
「Posted [Acknowledge] action to Icinga 2.. (Icinga 2 に [承認] アクションを送信..)」がログにない場合、Jira Service Management は「承認」アクションを Icinga 2 に送信していません。統合設定を確認してください。一致するアラート・アクションが存在しない可能性があります。
「Posted [Acknowledge] action to Icinga 2.. (Icinga 2 に [承認] アクションを送信..)」のみがログに記録されており、それ以降に関連するログがない場合は、JEC に接続の問題が発生している可能性があります。ログを確認してください。
3. Icinga RPM パッケージを開けなかった
rpm パッケージのインストール時に、そのパッケージが旧バージョンであることが判明した場合は、代わりに
rpm -i jsm-icinga2-1.0.4-rpm-x86-64.rpm --nodepsをご利用ください。「インストール済みです」というエラーが表示された場合は、代わりに
rpm -i jsm-icinga2-1.0.4-rpm-x86-64.rpm --forceをご利用ください。
4. icinga2 の perf_data.png で生成されたエラー
perfData graphite を HTML に埋め込む際にエラーが発生した場合は、ご利用の Icinga 2 のバージョンが、graphite の名前として、perf_data.png の代わりに perfData.png を使用している可能性があります。この問題を修正するには、次のように Python スクリプトを更新します。
From:
buf += """<div class="img"><img src="perf_data.png"></div>"""
To:
buf += """<div class="img"><img src="perfData.png"></div>"""
この内容はお役に立ちましたか?