ユーザーとして Opsgenie の利用を開始する
プロフィールの設定、Opsgenie からの通知の取得、オンコール スケジュールの表示に関するすべての方法を説明します。
Opsgenie provides a powerful bidirectional integration with OP5. When a new alert - host or service - is created in OP5, a corresponding Opsgenie alert is automatically created, containing rich information about the alert. Opsgenie provides detailed notifications with on-call rotations, scheduling features, and alert escalations. Users select any of the alert actions of Opsgenie to map to the Acknowledge action of OP5.
OP5 to Opsgenie
When a host or service alert is created on OP5, an alert is created in Opsgenie.
When a host or service alert is closed on OP5, the corresponding alert is closed in Opsgenie.
When a host or service alert is acknowledged on OP5, the corresponding alert is acknowledged in Opsgenie.
Opsgenie to OP5
If Send alert updates back to OP5 is selected, actions that are run on OP5 alerts are sent to OP5 as acknowledgment actions.
OP5 is a bidirectional integration. Setting it up involves the following steps:
Add an OP5 integration in Opsgenie
Map alert actions
Configure the integration in OP5
Opsgenie Edge Connector (abbreviated as OEC) is a prerequisite for configuring the outgoing authentication of OP5 integration. Download the latest version of the OP5 package from this repository.
Either share the OP5 file to the remote OP5 monitor or copy the link on the opening page.
次のコマンドを実行します。
wget https://linkTo.the.OP5Package
次のコマンドを実行します。
rpm -i opsgenie-op5-<your_version>.rpm
Before rpm upgrades, back up your configuration files.
During upgrades, the rpm package does not overwrite the existing configuration. It saves the new default configuration file as integration.conf.rpmnew. To update from version 201X-XX-XX to 2.X.X, add the --force parameter. For example: rpm -U --force opsgenie-integration-<your_version>.rpm
Learn more about rpm upgrade config file handling.
Opsgenie の Free プランまたは Essentials プランを使用している、または Jira Service Management の Standard プランで Opsgenie を使用している場合は、チーム ダッシュボードからのみこの統合を追加できます。このプランでは、[設定] の [統合] ページが利用できません。
[チーム] に移動して自分のチームを選択します。
左側のナビゲーションで [統合] を選択し、[統合を追加] を選択します。
統合をチーム ダッシュボードから追加すると、そのチーム統合の所有者になります。Opsgenie では、この統合を通じて受信したアラートはそのチームのみに割り当てられます。このセクションの残りの手順に従って、統合を設定してください。
Go to Settings > Integrations.
Select Add integration.
Run a search and select “OP5”.
次の画面で、統合の名前を入力します。
オプション: 特定のチームが統合からのアラートを受信するようにする場合は、[Assignee team (担当者チーム)] のチームを選択します。
[続行] を選択します。
この時点で、統合が保存されます。
Expand the Steps to configure the integration section and copy the integration API key.
You will use this key while configuring the integration in OP5 later.
[統合をオンにする] を選択します。
統合のために作成したルールは、統合をオンにした場合にのみ機能します。
The plugin uses a golang-executable file (included in the plugin as send2opsgenie) to create, acknowledge, and close alerts in Opsgenie. Configure OP5 to execute this file on events to create, acknowledge, and close alerts in Opsgenie. Setting the apiKey is mandatory. Other configuration parameters are set to defaults that work with OP5.
The following table lists the parameters and their locations:
設定パラメーター |
| 場所 |
---|---|---|
API キー | 上記で作成した OP5 統合から API キーをコピーします。send2opsgenie はこのキーを使用して Opsgenie への認証を行います。API キーは、アラートの処理に使用する必要がある適切な統合構成を識別するためにも用いられます。 | /home/opsgenie/oec/conf/config.json |
ベース URL | Opsgenie を別のドメイン (例:EU、サンドボックス) から使用している場合は、[詳細設定] ページでこの configuration.Opsgenie OP5 統合をアップデートする必要があります。 | /home/opsgenie/oec/conf/config.json |
responders | responders フィールドは、OP5 アラートを通知する必要があるチームを指定するために使用されます。このフィールドは、既定のチーム フィールド値を設定するために使用されます。Opsgenie OP5 インテグレーションの [詳細設定] ページで、異なるアラートを異なるチームにルーティングするように変更します。 | /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 |
nagios2opsgenie.http.proxy.enabled | nagios2opsgenie.http.proxy.enabled フィールドは、外部プロキシの設定を有効または無効にします。既定は false です。 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
nagios2opsgenie.http.proxy.host | これは、プロキシのホストです。 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
nagios2opsgenie.http.proxy.port | プロキシのポートです。 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
nagios2opsgenie.http.proxy.scheme | これは、プロキシ接続プロトコルです。プロキシ サーバーによって、http または https になる場合があります。既定値は http です。 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
nagios2opsgenie.http.proxy.username | プロキシ認証ユーザー名です。 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
nagios2opsgenie.http.proxy.password | これは、プロキシ認証パスワードです。 | /home/opsgenie/oec/conf/opsgenie-integration.conf |
Configure the golang-executable file in any of the following three methods:
Configure from the /home/opsgenie/oec/conf/integration.conf file. This overwrites any configuration you previously made in the script.
Configure by entering flags into the command in the opsgenie.cfg file. Use -apiKey flag for your apiKey and -ns flag for nagios_server name. If multiple OP5 servers are not in use, there is no need to define the nagios server. Using flags overwrites all the other configuration methods discussed earlier in the article.
Configure the apiKey from the cfg file as follows:
1
2
3
4
define command {
command_name notify-service-by-opsgenie
command_line /home/opsgenie/oec/scripts/send2opsgenie -apiKey="apiKey1" -entityType=service ...
}
apiKey を cfg ファイルに追加すると、config.json ファイル内の apiKey が上書きされます。
To send additional custom arguments, add them after the flags. For example, customArgName1 customArgValue1 customArgName2 customArgValue2. Parse custom arguments by adding {{_payload.customArgName}} to wherever is needed in the input fields. To learn more about using raw parameters, see dynamic fields.
Configure apiKey and nagios_server from send2opsgenie.go script. To use this option, build the script again and put the new executable to /usr/bin directory. Find information about the location of the send2opsgenie.go and how to build a go script in the "Source for send2opsgenie and recompiling" section.
Log in to your OP5 monitor.
Go to the /opt/monitor/etc directory to find nagios.cfg.
cd /opt/monitor/etc
Add the following line to the main Nagios configuration file (nagios.cfg).
1
2
3
...
cfg_file=opsgenie.cfg
...
Reboot the monitor to see the "opsgenie" contact in the contact list.
Add the contact "opsgenie" to the OP5 Monitor’s main contact group.
If everything goes well, alerts are created in Opsgenie for every notification created in OP5.
You can define mappings between Opsgenie actions and OP5 actions (also when the source of the alert is OP5), which requires additional authentication for your OP5 account.
Username: The username of your OP5 account
Password: The password of your OP5 account
OP5 Monitor URL: This is the domain name of your OP5 Monitor. For example: https://19.167.1.143
OP5 によって作成されたアラートの場合
In the Send alert updates back to OP5 section, map Opsgenie actions to OP5 actions when the source of the alert is OP5 (when the alert is created by OP5 integration itself). Map different Opsgenie actions to different OP5 actions. For example, acknowledge the alert in OP5, when the alert is acknowledged from OP5. To do this, define If alert is acknowledged in Opsgenie, acknowledge in OP5 mapping in Send alert updates back to OP5 section.
このステップはオプションです。
Use Opsgenie’s OEC and the OP5 script to update alerts on OP5. This enables deployment of your own scripts/ability to modify the ones provided and execute customized actions on OP5. To execute actions in OP5, OEC gets the configuration parameters from the configuration file. The configuration file is found under /home/opsgenie/oec/conf/oec-config.json.
url – OEC は、この URL を使用して構築されたエンドポイントにアラート アクションを投稿します。
username – OEC uses your OP5 account's username to authenticate.
password – OEC uses your OP5 account's password to authenticate.
The package that you downloaded also includes OEC utility which is located under /usr/local/bin and the script that is needed to be run by OEC which is under /home/opsgenie/oec/scripts. After the configuration of OEC is done, be sure to run it. Learn more about running OEC.
The source for the executable send2opsgenie is found in /usr/bin/ and send2opsgenie.go, in /home/opsgenie/oec/scripts respectively and is also available in this repository. To change the behavior of the executable, edit send2opsgenie.go and build it by using the following command: go build send2opsgenie.go
For installing go, refer to http://golang.org/doc/install. Note that the executable in the plugin is built for linux/amd64 systems.
If the integration is not working, review this section and follow the guidance prescribed:
シェルから次のテスト コマンドを実行します。Opsgenie でアラートが作成されているかどうかを確認します。
/home/opsgenie/oec/scripts/send2opsgenie -entityType=host -t=PROBLEM -hs=DOWN -hn=test_host
If "Trace/breakpoint trap" error occurs: It means the send2opsgenie plugin isn't compatible with the server distribution. Follow the "Source for and recompiling send2opsgenie" section on this page and rebuild send2opsgenie.go according to the specific server environment.
If the alert is created in Opsgenie: It means the integration is configured correctly. The problem might be that OP5 is not notifying the Opsgenie contact for alerts. Check the OP5 alert notifications log.
If not: Check the log files under /var/log/oec. Look for the following errors in the log file:
If a "RestException[Could not authenticate.]" error appears in the logs, it means Opsgenie couldn't identify your API key. Check if the API key is set correctly, as explained in "Configure OP5 Package in OP5 Monitor" on this page.
If "Could not execute this action with apiKey of [OP5] integration" appears in the logs, the wrong integration package may have been downloaded. Make sure to download the OP5 integration package.
If unsure of the problem, set the plugin's log level to debug, try again, and contact us and send the logs. If there is no log files under /var/log/oec file, or there are no logs in it, check the following:
First, make sure the nagios user has permission to write to /var/log/oec directory. The installation package automatically does this for you. If you encounter problems, execute chown -R nagios:nagios:opsgenie /var/log/oec.
Now check the OP5 server logs under /var/log/oec. See if there are error logs regarding send2opsgenie, and contact us with them.
Set log level of send2opsgenie plugin to DEBUG
Change the line send2opsgenie.logger=warning to nagios2opsgenie.logger = debug in /home/opsgenie/oec/conf/integration.conf file.
Set the send2opsgenie plugin's log level to DEBUG. Open the /home/opsgenie/oec/conf/integration.conf file and change the line zenoss2opsgenie.logger=warning to zenoss2opsgenie.logger=debug.
まず、アラート ログを確認します。
If a "Posted [Acknowledge] action to OP5.." error does not appear in the log, it means Opsgenie didn't send the Acknowledge action to OP5. Check the integration configuration, it might not have matched the alert action.
"Executed [Acknowledge] action via OEC with errors."エラーがログに表示された場合、OEC の op5ActionExecutor.Groovyスクリプトでエラーが発生したことを意味します。/var/log/opsgenie/ の下のログファイルをチェックして、エラーログを確認します。
"Posted [Acknowledge] action to OP5.." エラーのみがログに表示されており、それ以降関連ログがない場合、OEC の接続に問題が発生している可能性があります。/var/log/opsgenie/ の下のログ ファイルをチェックして、エラー ログを確認します。
ログが存在しない場合は、OEC を再起動し、承認アクションをもう一度送信してみてください。
If you figure out while installing the rpm package that the package is obsolete, use rpm -i opsgenie-op5-1.0.4-rpm-x86-64.rpm --nodeps instead.
If you get "is already installed" error, use rpm -i opsgenie-op5-1.0.4-rpm-x86-64.rpm --force instead.
If unsure of the problem, set the OEC's script log level to “debug” and try again. Contact us with the log files found under /var/log/opsgenie/.
この内容はお役に立ちましたか?