Opsgenie を Jira Service Management と統合する
Opsgenie provides a powerful two-way integration with Jira Service Management. When a new work item is created in Jira Service Management, a corresponding Opsgenie alert is automatically created, containing rich information about the work item. Opsgenie provides rich notifications with on-call rotations, scheduling features, and alert escalations to ensure the best alert and incident management for Jira Service Management customers. As users execute actions on the alerts, like acknowledge or snooze, the work item in Jira Service Management automatically updates with comments about these alert actions. If users close the alert, the work item in Jira Service Management is resolved (Only if the work item has a Resolve the work item transition).
統合の機能性
Jira Service Management から Opsgenie へ:
When a work item is created in Jira Service Management, an alert is created in Opsgenie.
When a comment is added to a work item in Jira Service Management, the same comment is added as a note to the alert in Opsgenie.
When a work item is closed and resolved in Jira Service Management, the alert in Opsgenie is closed.
Opsgenie から Jira Service Management へ
[アラートの更新を Jira Service Management に返信] が有効な場合は、Jira Service Management 統合によって作成されたアラートに対して選択したアクションが Opsgenie で実行されると、Jira Service Management のアクションが Jira Service Management で実行されます。
If Create Jira Service Management Work Items for Opsgenie Alerts is enabled, actions for Jira Service Management are executed in Jira Service Management when the chosen action is executed in Opsgenie for alerts which have a source other than the Jira Service Management integration.
このアクション マッピング機能の詳細については、以下の「アクション マッピング機能」セクションで説明します。
Opsgenie で Jira Service Management インテグレーションを追加する
Opsgenie の Free プランまたは Essentials プランを使用している、または Jira Service Management の Standard プランで Opsgenie を使用している場合は、チーム ダッシュボードからのみこの統合を追加できます。 このプランでは、[設定] の [統合] ページが利用できません。
[チーム] に移動して自分のチームを選択します。
左側のナビゲーションで [統合] を選択し、[統合を追加] を選択します。
統合をチーム ダッシュボードから追加すると、そのチーム統合の所有者になります。Opsgenie では、この統合を通じて受信したアラートはそのチームのみに割り当てられます。このセクションの残りの手順に従って、統合を設定してください。
[設定] > [統合] の順に移動します。Jira Service Management を検索して [追加] を選択します。
[応答者] フィールドを使用して、Jira Service Management アラートの通知先を指定します。入力し始めると、オートコンプリートの候補が表示されます。
統合 URL をコピーして、Jira Service Management 設定で使用します。
[Save Integration (インテグレーションを保存)] をクリックします。
SSO の使用
SSO によって Jira にログインする場合は、API トークンを生成して統合設定のパスワードとして使用する必要があります。Jira で API トークンを生成する方法については「Atlassian アカウントの API トークンを管理する」をご参照ください。
新しいトークンを生成したら、Opsgenie の Jira 統合の [パスワード] フィールドにコピー & ペーストします。その後、統合を保存します。
アトラシアン アカウントを持っていないユーザー
REST API に対して認証を行っているユーザーで、アトラシアン アカウントを持っていないユーザーは、アカウントをアトラシアン アカウントに変換する必要があります。アトラシアン アカウントを変換する手順は、こちらからチェックできます。
アクション マッピング機能
Opsgenie では、Opsgenie と Jira Service Management の各アクション間のアクション マッピングを定義できます。
アクション マッピング機能を使用するには、以下に示す統合にいくつかの情報を提供します。
Work Type Name: The work types defined in Jira Service Management e.g. Task, IT Help, Sub-task, Service Request or any other custom defined type. Make sure you write the work type syntax error-free.
Jira Service Management URL: サービスのドメイン名。例: https://testops.atlassian.net
ユーザー名: Jira Service Management へのログインに使用するメール アドレス。
パスワード/API トークン: Jira Service Management へのログインに使用するパスワードまたは API トークン。
プロジェクト キー: アラートを作成するプロジェクトのキー。例: OT、OPS、SIT。プロジェクト キーは通常大文字ですので、正しい形式で記述してください。
Jira Service Management によって作成されたアラートの場合
このセクションによって、アラートのソースが Jira Service Management である際は Opsgenie のアクションを Jira Service Management のアクションにマッピングできます (アラートが Jira Service Management 統合によって作成された場合)。
You can map different Opsgenie actions to different Jira Service Management actions. For example, you can add note to Jira Service Management work item, when the alert is acknowledged. In order to do this, you should define If alert is acknowledged in Opsgenie, add it as a comment to the work item in Jira Service Management. mapping in Send Alert Updates Back to Jira Service Management section.
Opsgenie のその他のアラートの場合
このセクションを使用して、アラートのソースが Jira Service Management でない場合、Opsgenie アクションを Jira Service Management アクションにマッピングできます (アラートが別の統合によって作成された場合)。
For this purpose, you can use Create Jira Service Management Work Items for Opsgenie Alerts section. In order to use this functionality, you need to map one Opsgenie action to create a work item Jira Service Management action. The Opsgenie action doesn't have to be alert is created, it can be other actions as well.
アラートにタグが追加され、他のアクションとは異なるアラート アクションに対してカスタム アクションが実行されます。これらのアクションのいずれかを選択すると、このマッピングが機能するタグまたはカスタム アクションを入力するための追加のフィールドが追加されます。
タグをカンマで区切って、複数のタグを入力します。複数のタグを入力した場合、マッピングは、指定されたタグが 1 つ以上アラートにある場合に機能します。どのタグでもマッピングが機能するには、[タグ] フィールドを空のままにします。
Opsgenie アクションが複数の Jira Service Management アクションにマッピングされている場合は、「タグがアラートに追加される」と「カスタム アクションがアラートに対して実行される」の各アクションを除いて、エラーが発生します。これらのアクションは、指定されたタグ名やカスタム アクション名によって異なるため、複数のマッピングを保存します。
Jira Service Management での設定
管理者として Jira にログインします。
ダッシュボードから [管理] メニューを開きます。[システム] を選択します。
左側の [詳細設定] の下の [Webhook] を選択します。
4. [Webhook の作成] をクリックします。開いたセクションで、Opsgenie の Jira インテグレーションによって提供された URL を URL 入力に貼り付けます。[作成] をクリックします。
5. [本文を除外] チェックボックスがオフになっていることを確認します。
Jira Service Management アラートを Opsgenie で管理して、そのアラート機能をフル活用しましょう。
Jira Service Management から送信されたペイロードの例
アラートのペイロードを作成します。
JSON
{
"issue": {
"id": "10042",
"self": "https://test.atlassian.net/rest/api/2/issue/10042",
"key": "TEST-43",
"fields": {
"issuetype": {
"self": "https://test.atlassian.net/rest/api/2/issuetype/10000",
"id": "10000",
"description": "For system outages or incidents. Created by JIRA Service Management.",
"iconUrl": "https://test.atlassian.net/servicedesk/issue-type-icons?icon=incident",
"name": "Incident",
"subtask": false
},
"timespent": null,
"project": {
"self": "https://test.atlassian.net/rest/api/2/project/10000",
"id": "10000",
"key": "TEST",
"name": "Test",
"avatarUrls": {
"48x48": "https://test.atlassian.net/secure/projectavatar?avatarId=10324",
"24x24": "https://test.atlassian.net/secure/projectavatar?size=small&avatarId=10324",
"16x16": "https://test.atlassian.net/secure/projectavatar?size=xsmall&avatarId=10324",
"32x32": "https://test.atlassian.net/secure/projectavatar?size=medium&avatarId=10324"
}
},
"fixVersions": [],
"aggregatetimespent": null,
"resolution": null,
"customfield_10027": {
"id": "1",
"name": "Time to resolution",
"_links": {
"self": "https://test.atlassian.net/rest/servicedeskapi/request/10042/sla/1"
},
"completedCycles": [
{
"startTime": {
"iso8601": "2016-06-27T11:25:37+0300",
"jira": "2016-06-27T11:25:37.877+0300",
"friendly": "Today 11:25 AM",
"epochMillis": 1467015937877
},
"stopTime": {
"iso8601": "2016-06-27T11:37:33+0300",
"jira": "2016-06-27T11:37:33.572+0300",
"friendly": "Today 11:37 AM",
"epochMillis": 1467016653572
},
"breached": false,
"goalDuration": {
"millis": 14400000,
"friendly": "4h"
},
"elapsedTime": {
"millis": 715695,
"friendly": "11m"
},
"remainingTime": {
"millis": 13684305,
"friendly": "3h 48m"
}
}
],
"ongoingCycle": {
"startTime": {
"iso8601": "2016-06-27T16:01:45+0300",
"jira": "2016-06-27T16:01:45.920+0300",
"friendly": "Today 4:01 PM",
"epochMillis": 1467032505920
},
"breachTime": {
"iso8601": "2016-06-28T12:01:45+0300",
"jira": "2016-06-28T12:01:45.920+0300",
"friendly": "28/Jun/16 12:01 PM",
"epochMillis": 1467104505920
},
"breached": false,
"paused": false,
"withinCalendarHours": true,
"goalDuration": {
"millis": 14400000,
"friendly": "4h"
},
"elapsedTime": {
"millis": 197118,
"friendly": "3m"
},
"remainingTime": {
"millis": 14202882,
"friendly": "3h 56m"
}
}
},
"customfield_10028": {
"id": "2",
"name": "Time to first response",
"_links": {
"self": "https://test.atlassian.net/rest/servicedeskapi/request/10042/sla/2"
},
"completedCycles": [
{
"startTime": {
"iso8601": "2016-06-27T11:25:37+0300",
"jira": "2016-06-27T11:25:37.877+0300",
"friendly": "Today 11:25 AM",
"epochMillis": 1467015937877
},
"stopTime": {
"iso8601": "2016-06-27T11:37:33+0300",
"jira": "2016-06-27T11:37:33.572+0300",
"friendly": "Today 11:37 AM",
"epochMillis": 1467016653572
},
"breached": false,
"goalDuration": {
"millis": 14400000,
"friendly": "4h"
},
"elapsedTime": {
"millis": 715695,
"friendly": "11m"
},
"remainingTime": {
"millis": 13684305,
"friendly": "3h 48m"
}
}
]
},
"resolutiondate": null,
"workratio": -1,
"lastViewed": "2016-06-27T16:01:46.447+0300",
"watches": {
"self": "https://test.atlassian.net/rest/api/2/issue/TEST-43/watchers",
"watchCount": 1,
"isWatching": true
},
"created": "2016-06-27T11:25:37.859+0300",
"customfield_10020": "Not started",
"customfield_10021": null,
"customfield_10022": null,
"priority": {
"self": "https://test.atlassian.net/rest/api/2/priority/3",
"iconUrl": "https://test.atlassian.net/images/icons/priorities/medium.svg",
"name": "Medium",
"id": "3"
},
"customfield_10023": [],
"customfield_10024": null,
"customfield_10025": null,
"labels": [],
"customfield_10026": null,
"customfield_10016": null,
"customfield_10017": null,
"customfield_10018": null,
"customfield_10019": null,
"timeestimate": null,
"aggregatetimeoriginalestimate": null,
"versions": [],
"issuelinks": [],
"assignee": null,
"updated": "2016-06-27T16:05:02.852+0300",
"status": {
"self": "https://test.atlassian.net/rest/api/2/status/10001",
"description": "This was auto-generated by JIRA Service Desk during workflow import",
"iconUrl": "https://test.atlassian.net/images/icons/status_generic.gif",
"name": "Waiting for support",
"id": "10001",
"statusCategory": {
"self": "https://test.atlassian.net/rest/api/2/statuscategory/1",
"id": 1,
"key": "undefined",
"colorName": "medium-gray",
"name": "No Category"
}
},
"components": [],
"timeoriginalestimate": null,
"description": "test description",
"customfield_10010": null,
"customfield_10011": null,
"customfield_10012": null,
"customfield_10013": null,
"customfield_10014": null,
"timetracking": {},
"customfield_10015": null,
"customfield_10007": "0|i0009b:",
"customfield_10008": "com.atlassian.servicedesk.plugins.approvals.internal.customfield.ApprovalsCFValue@cf82e6",
"attachment": [],
"customfield_10009": null,
"aggregatetimeestimate": null,
"summary": "New Summary",
"creator": {
"self": "https://test.atlassian.net/rest/api/2/user?username=admin",
"name": "admin",
"key": "admin",
"emailAddress": "email@emailserver.tld",
"avatarUrls": {
"48x48": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=48",
"24x24": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=24",
"16x16": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=16",
"32x32": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=32"
},
"displayName": "Administrator",
"active": true,
"timeZone": "Europe/Helsinki"
},
"subtasks": [],
"reporter": {
"self": "https://test.atlassian.net/rest/api/2/user?username=admin",
"name": "admin",
"key": "admin",
"emailAddress": "email@emailserver.tld",
"avatarUrls": {
"48x48": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=48",
"24x24": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=24",
"16x16": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=16",
"32x32": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=32"
},
"displayName": "Administrator",
"active": true,
"timeZone": "Europe/Helsinki"
},
"customfield_10000": null,
"aggregateprogress": {
"progress": 0,
"total": 0
},
"customfield_10001": null,
"customfield_10002": null,
"customfield_10003": null,
"environment": null,
"duedate": null,
"progress": {
"progress": 0,
"total": 0
},
"comment": {
"comments": [
{
"self": "https://test.atlassian.net/rest/api/2/issue/10042/comment/10027",
"id": "10027",
"author": {
"self": "https://test.atlassian.net/rest/api/2/user?username=admin",
"name": "admin",
"key": "admin",
"emailAddress": "email@emailserver.tld",
"avatarUrls": {
"48x48": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=48",
"24x24": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=24",
"16x16": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=16",
"32x32": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=32"
},
"displayName": "Administrator",
"active": true,
"timeZone": "Europe/Helsinki"
},
"body": "test comment",
"updateAuthor": {
"self": "https://test.atlassian.net/rest/api/2/user?username=admin",
"name": "admin",
"key": "admin",
"emailAddress": "email@emailserver.tld",
"avatarUrls": {
"48x48": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=48",
"24x24": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=24",
"16x16": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=16",
"32x32": "https://secure.gravatar.com/avatar/asd0a6bb5e5c8ce4c5152b54b45ee5c?d=mm&s=32"
},
"displayName": "Administrator",
"active": true,
"timeZone": "Europe/Helsinki"
},
"created": 1467032702852,
"updated": 1467032702852
}
],
"maxResults": 1,
"total": 1,
"startAt": 0
},
"votes": {
"self": "https://test.atlassian.net/rest/api/2/issue/TEST-43/votes",
"votes": 0,
"hasVoted": false
},
"worklog": {
"startAt": 0,
"maxResults": 20,
"total": 0
}
}
},
"timestamp": 1467032703044
}
OEC を介したインテグレーション (オンプレミスの Jira Service Management の用途用)
現在、Jira Service Desk は Jira Service Management になりました。製品名は変更されている可能性がありますが、次の更新まで、スクリプトでは古い名前 (Jira Service Desk) を引き続き使用します。
Opsgenie の OEC と Jira ServiceDesk スクリプトによって、Jira Service Management でリクエストを更新します。これによって独自のスクリプトや機能をデプロイすることで、事前に提供された機能を変更したり、カスタマイズしたアクションを Jira Service Management 上で実行したりできるようになります。
Jira ServiceDesk インテグレーション パッケージを使用するには、以下のセクションのステップを最後まで実行します。
OEC の最新バージョンをダウンロードする
JiraServiceDesk パッケージの最新バージョンをダウンロードするには、oec-scripts リポジトリの readme ファイルを使用してください。
インストール
Red Hat ベースのディストリビューションの場合
次のコマンドを実行します。
rpm -i opsgenie-jiraservicedesk-<your_version>.rpm
Debian ベースのディストリビューションの場合
次のコマンドを実行します。
dpkg -i opsgenie-jiraservicedesk-<your_version>.deb
Windows の場合
OEC パッケージを含む opsgenie jiraservicedesk の zip ファイルをディレクトリ内に解凍します (C:\opsgenie は優先パスです)。Windows に OEC をインストールするには、こちらの指示に従います。
OEC の実行方法について詳しくは、OEC の実行のドキュメントを参照してください。
OEC 用の Jira Service Management インテグレーションの設定
OEC ユーティリティを使用するには、[OEC 経由で送信] を有効にします。
Jira Service Management に関するその他の設定は、統合ページ、または OEC 設定ファイルの config.json を介して行えます。統合ページを介した設定は、設定ファイルより優先されます。
OEC 設定
Jira でアクションを実行できるように、OEC ではパス /home/opsgenie/oec/conf/config.json にある設定ファイルから設定パラメーターが取得されます。
設定パラメーター
apiKey — 上記で作成した Jira インテグレーションから API キーをコピーします。
issueTypeName – Work type, which can be "Task", "Bug", "Story" or your custom work type ("Epic" is not supported).
url – Your Jira Service Management url where work items will be created, resolved, closed etc.
username – Jira Service Management アカウントのユーザー名。
password – Jira Service Management アカウントのパスワード。
key – The work items will be created for this project.
ダウンロードしたパッケージには、/usr/local/bin にある OEC ユーティリティと、/home/opsgenie/oec/scripts にある OEC によって実行する必要があるスクリプトも含まれています。OEC の構成が完了したら、OEC を実行する必要があります。OEC の実行方法の詳細については、OEC の実行に関するドキュメントを参照してください。
OEC に送信されるパラメーターの例
JSON
{
"summary":"test",
"issueTypeName":"Task",
"integrationName":"Jira Service Management",
"sendViaOEC":true,
"description":"this is a test",
"integrationId":"3af28c92-b71c-459c-8d72-04a6f7f7ebac",
"url":"https://jiratestopsgenie.atlassian.net",
"password":"******",
"projectKey":"OPSGENIE",
"integrationType":"JiraServiceDesk",
"customerId":"04912a27-5fc1-4145-a6dd-8819afc0d870",
"alias":"c570a4cc-3f57-4b60-814e-f04c63e7442d",
"action":"Create",
"alertId":"c570a4cc-3f57-4b60-814e-f04c63e7442d",
"key":null,
"mappedAction":"createIssue",
"username":"jiratest@opsgenie.com"
}
トラブルシューティング
If a mandatory custom field is set for creating a work item in Jira Service Management, a Jira Service Management work item cannot be created from an Opsgenie alert. However, by using OEC and configuring the script, the creation of Jira request can be achieved.
If a comment cannot be added to a work item by performing an action on an alert, please look at the Logs page first. If the URL does not contain the work item key it means there is no work item in Jira ServiceManagement populated from that alert. Thus it could not add a comment to a non-existing work item.
Opsgenie's Jira Service Management integration allows setting the status of the work item to RESOLVED in Jira Service Management. However, if the workflow of the project does not allow that transitions, you cannot set that transition using Opsgenie too.
Jira Service Management は ASCII 以外の文字をサポートしていません。ペイロードで ASCII 以外の文字を Jira Service Management に送信すると、400 不正なリクエスト エラーが発生する可能性があります。
If the Jira Service Management integration is assigned to a team, in order to create work items in Jira Service Management from alerts created in Opsgenie, the other integrations must also be assigned to the same team, or, no team must be assigned for both the Jira Service Management integration and the other Opsgenie integrations.
Opsgenie アラートから Jira Service Management リクエストの作成を試みた後にアクティビティ ログで「理由: 400 不正なリクエスト」エラーを受信した場合は、[ログ] ページでこの応答の詳細をご確認ください。[ログ] ページに表示されるエラーの例: "labels":"フィールド 'labels' は設定できません。適切な画面上にないか不明です"。これを解決するには、Jira Service Management アカウントに移動してプロジェクト設定から欠落しているフィールドを追加します。
この内容はお役に立ちましたか?