Opsgenie を New Relic ワークフローと統合する

概要
統合でできるようになること
Opsgenie には、New Relic ワークフローとのネイティブ統合があります。統合によって、New Relic 課題を詳細な情報とともに Opsgenie の API に送信します。Opsgenie は New Relic 課題のディスパッチャーとして機能します。オンコール スケジュールに基づいて通知すべきユーザーを決定して、メール、テキスト メッセージ (SMS)、電話、iPhone や Android のプッシュ通知による通知を行い、アラートが承認またはクローズされるまでアラートをエスカレートします。
このドキュメントでは、Opsgenie が New Relic から受信するデータの統合と詳細を設定する方法について説明します。
統合による機能
New Relic ワークフローでアラートが作成されると、統合によって Opsgenie でもアラートが自動で作成されます。
New Relic ワークフローでアラートがクローズされると、関連するアラートも統合によって Opsgenie で自動的にクローズされます。
New Relic ワークフローでアラートが承認されると、関連するアラートも統合によって Opsgenie で自動的に承認されます。
統合をセットアップする
New Relic は API ベースの統合です。次のステップに沿ってセットアップを行います。
Opsgenie に New Relic 統合を追加する
New Relic で統合を設定する
New Relic 統合を追加する
Opsgenie の Free プランまたは Essentials プランを使用している、または Jira Service Management の Standard プランで Opsgenie を使用している場合は、チーム ダッシュボードからのみこの統合を追加できます。 このプランでは、[設定] の [統合] ページが利用できません。
[チーム] に移動して自分のチームを選択します。
左側のナビゲーションで [統合] を選択し、[統合を追加] を選択します。
統合をチーム ダッシュボードから追加すると、そのチーム統合の所有者になります。Opsgenie では、この統合を通じて受信したアラートはそのチームのみに割り当てられます。このセクションの残りの手順に従って、統合を設定してください。
Opsgenie に New Relic 統合を追加するには、次の手順に従います。
Go to Settings > Integrations.
[統合を追加] を選択します。
検索を実行して「New Relic」を選択します。
次の画面で、統合の名前を入力します。
オプション: 特定のチームが統合からのアラートを受信するようにする場合は、[Assignee team (担当者チーム)] のチームを選択します。
[Continue] を選択します。
この時点で、統合が保存されます。[統合を設定する手順] セクションを展開して、エンドポイント URL をコピーします。
この URL は、後ほど New Relic で統合を設定する際に使用します。[統合をオンにする] を選択します。
統合のために作成したルールは、統合をオンにした場合にのみ機能します。
New Relic で統合を設定する
Select Alert & AI from the side menu from your New Relic account.
[宛先] を選択します。
Webhook の宛先を作成します。
Webhook の名前を入力します。
Paste the URL you copied while adding the integration in Opsgenie into Endpoint URL.
[アラート & AI] から [ワークフロー] を選択して、新しいワークフローを作成します。
先ほど作成した Webhook の宛先を使用します。Test the New Relicpayload in the Payload template for webhook.
For the New Relic payload template, see the following article.[メッセージを更新] を選択します。
[ワークフローを有効化] を選択します。
ワークフローが New Relic で有効になっているか、ご確認ください。
New Relic ペイロード テンプレート
New Relic でワークフローを作成する際に使用するペイロード テンプレート:
{
"tags": "tag1,tag2",
"teams": "team1,team2",
"recipients": "user1,user2",
"payload": {
"condition_id": {{json accumulations.conditionFamilyId.[0]}},
"condition_name": {{json accumulations.conditionName.[0] }},
"current_state": {{#if issueClosedAtUtc}} "closed" {{else if issueAcknowledgedAt}} "acknowledged" {{else}} "open"{{/if}},
"details": {{json issueTitle}},
"event_type": "Incident",
"incident_acknowledge_url": {{json issueAckUrl }},
"incident_api_url": "N/A",
"incident_id": {{json issueId }},
"incident_url": {{json issuePageUrl }},
"owner": "N/A",
"policy_name": {{ json accumulations.policyName.[0] }},
"policy_url": {{json issuePageUrl }},
"runbook_url": {{ json accumulations.runbookUrl.[0] }},
"severity": {{#eq "HIGH" priority}} "WARNING" {{else}}{{json priority}} {{/eq}},
"targets": {
"id": {{ json entitiesData.entities.[0].id }},
"name": {{ json entitiesData.entities.[0].name }},
"type": "{{entitiesData.entities.[0].type }}",
"product": "{{accumulations.conditionProduct.[0]}}"
},
"timestamp": {{#if closedAt}} {{ closedAt }} {{else if acknowledgedAt}} {{ acknowledgedAt }} {{else}} {{ createdAt }} {{/if}}
}
}
New Relic から送信される JSON ペイロードの例
(JSON 形式)
{
"tags": "tag1,tag2",
"teams": "team1,team2",
"recipients": "user1,user2",
"payload": {
"condition_id": 1,
"condition_name": "test condition",
"current_state": "open",
"details": "CPU > 50% for 5 minutes",
"event_type": "INCIDENT",
"incident_acknowledge_url": "http://localhost/incident/1/acknowledge",
"incident_api_url": "http://localhost/api/incident/1",
"incident_id": 1,
"incident_url": "http://localhost/incident/1",
"owner": "John Doe",
"policy_name": "test policy",
"policy_url": "http://localhost/policy/1",
"runbook_url": "http://localhost/runbook/url",
"severity": "CRITICAL",
"targets": [
{
"id": "12345",
"link": "http://localhost/target/12345",
"name": "Test Target",
"labels": [
"production",
"hostname"
],
"type": "Server",
"product" : "productName"
}
],
"timestamp": 123456789000
}
}
Opsgenie によって解析されたペイロード
(JSON 形式)
[
"owner" : "John Doe",
"severity" : "CRITICAL",
"policy_url" : "http://localhost/policy/1",
"teams" : [
"team1", "team2"
],
"target_name" : "Test Target",
"target_type" : "Server",
"policy_name" : "test policy",
"incident_url" : "http://localhost/incident/1",
"incident_acknowledge_url" : "http://localhost/incident/1/acknowledge",
"tags" : [
"tag1", "tag2"
],
"event_type" : "INCIDENT",
"incident_id" : "1",
"target_link" : "http://localhost/target/12345",
"runbook_url" : "http://localhost/runbook/url",
"recipients" : [
"user1", "user2"
],
"target_labels" : [
"production", "hostname"
],
"details" : "CPU > 50% for 5 minutes",
"state" : "open",
"condition_name" : "test condition",
"target_product" : "productName",
"timestamp" : "123456789000"
]
この内容はお役に立ちましたか?