Opsgenie を Microsoft Azure と統合する
概要
メトリック値に関するアラート ルールの場合、指定されたメトリックの値が割り当てられたしきい値を超えると、アラート ルールがアクティブになり、通知が送信されます。イベントに関するアラート ルールの場合、ルールはすべてのイベントについて、または特定の数のイベントが発生した場合にのみ、通知を送信できます。
統合でできるようになること
Azure は、メトリックとイベントに基づいてアラートを生成します。Opsgenie は Azure によって生成されたアラートのディスパッチャーとして機能します。Opsgenie は、メール、テキスト メッセージ (SMS)、電話、Android および iOS のプッシュ通知を使用して、オンコール スケジュールとエスカレーションに基づいて通知する適切なユーザーを決定します。
Opsgenie supports the new Azure metrics alerts as well. With the Azure new metric alerts, new fields are added to the new Azure payload. Hence, you can accordingly configure the integration to support them. Learn more about supported resources for metric alerts in Azure Monitor.
統合による機能
Azure でアラートが作成されると、統合によって Opsgenie でアラートが自動で作成されます。
統合をセットアップする
Azure は API ベースの統合です。設定は以下の手順で行います。
Opsgenie で Azure 統合を追加する
Azure で統合を設定する
Azure 統合を追加する
Opsgenie の Free プランまたは Essentials プランを使用している、または Jira Service Management の Standard プランで Opsgenie を使用している場合は、チーム ダッシュボードからのみこの統合を追加できます。 このプランでは、[設定] の [統合] ページが利用できません。
[チーム] に移動して自分のチームを選択します。
左側のナビゲーションで [統合] を選択し、[統合を追加] を選択します。
統合をチーム ダッシュボードから追加すると、そのチーム統合の所有者になります。Opsgenie では、この統合を通じて受信したアラートはそのチームのみに割り当てられます。このセクションの残りの手順に従って、統合を設定してください。
Opsgenie で Azure 統合を追加する方法は以下のとおりです。
Go to Settings > Integrations.
[統合を追加] を選択します。
検索を実行して「Azure」を選択します。
次の画面で、統合の名前を入力します。
オプション: 特定のチームが統合からのアラートを受信するようにする場合は、[Assignee team (担当者チーム)] のチームを選択します。
[Continue] を選択します。
この時点で、統合が保存されます。[統合を設定する手順] セクションを展開し、アカウント用に生成されたエンドポイント URL をコピーします。
この URL は、後ほど Azure で統合を設定する際に使用します。[統合をオンにする] を選択します。
統合のために作成したルールは、統合をオンにした場合にのみ機能します。
Azure で統合を設定する
1. Azure ポータルで [Browse (参照)] を選択します。
2. アラートを生成するリソースを選択します。
3. [Monitor (監視)] セクションで [Alerts (アラート)] を選択します。
4. [Manage actions (アクションの管理)] タブに移動します。
5. [Add-action-group] を選択してアクション グループを作成します。
6. アクションを追加する際は、アクション タイプに [Webhook] を選択します。
7. Paste the URL you copied while adding the integration in Opsgenie into URI.
8. 変更を保存します。
9. 必要に応じて、共通のアラート スキーマを有効にします。
10. [Manage alert rules (アラート ルールの管理)] に移動します。
11. ルールを作成するか、既存のルールを編集します。
12. アラートを作成する条件を追加します。
13. ステップ 5 で作成した Webhook アクション グループを [Action Group (アクション グループ)] セクションに追加します。
14. 変更を保存します。
Azure (クラシック) から送信されるペイロードのサンプル
アラート ペイロード (JSON 形式) を作成する
{
"status": "Activated",
"context": {
"id": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.insights/alertrules/Alert_1_runscope12",
"name": "Alert_1_runscope12",
"description": "desc",
"conditionType": "Metric",
"condition": {
"metricName": "Memory available",
"metricUnit": "Bytes",
"metricValue": "1032190976",
"threshold": "2",
"windowSize": "5",
"timeAggregation": "Average",
"operator": "GreaterThan"
},
"subscriptionId": "1a66ce04-b633-4a0b-b2bc-a912ec8986a6",
"resourceGroupName": "montest",
"timestamp": "2015-09-18T01:02:35.8190994Z",
"resourceName": "helixtest1",
"resourceType": "microsoft.compute/virtualmachines",
"resourceId": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/Microsoft.Compute/virtualMachines/Helixtest1",
"resourceRegion": "centralus",
"portalLink": "http://portallink.com"
},
"properties": {
"hello1": "World1!",
"json_stuff": {
"type": "critical",
"color": "red"
},
"customId": "wd39ue9832ue9iuhd9iuewhd9edh",
"send_emails_to": "someone@somewhere.com"
}
}
Opsgenie によって解析されたペイロード (JSON 形式)
{
"status": "Activated",
"id": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.insights/alertrules/Alert_1_runscope12",
"name": "Alert_1_runscope12",
"description": "desc",
"condition_type": "Metric",
"condition_metric_name": "Memory available",
"condition_metric_unit": "Bytes",
"condition_metric_value": "1032190976",
"condition_threshold": "2",
"condition_window_size": "5",
"condition_time_aggregation": "Average",
"condition_operator": "GreaterThan",
"subscription_id": "1a66ce04-b633-4a0b-b2bc-a912ec8986a6",
"resource_group_name": "montest",
"timestamp": "2015-09-18T01:02:35.8190994Z",
"resource_name": "helixtest1",
"resource_type": "microsoft.compute/virtualmachines",
"resource_id": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/Microsoft.Compute/virtualMachines/Helixtest1",
"resource_region": "centralus",
"portal_link": "http://portallink.com"
}
Azure (最新) から送信されるペイロードのサンプル
アラート ペイロード (JSON 形式) を作成する
{"schemaId":"AzureMonitorMetricAlert","data":
{
"version": "2.0",
"status": "Activated",
"context": {
"timestamp": "2018-02-28T10:44:10.1714014Z",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Contoso/providers/microsoft.insights/metricAlerts/StorageCheck",
"name": "StorageCheck",
"description": "",
"conditionType": "SingleResourceMultipleMetricCriteria",
"condition": {
"windowSize": "PT5M",
"allOf": [
{
"metricName": "Transactions",
"dimensions": [
{
"name": "AccountResourceId",
"value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Contoso/providers/Microsoft.Storage/storageAccounts/diag500"
},
{
"name": "GeoType",
"value": "Primary"
}
],
"operator": "GreaterThan",
"threshold": "0",
"timeAggregation": "PT5M",
"metricValue": 1.0
}
]
},
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"resourceGroupName": "Contoso",
"resourceName": "diag500",
"resourceType": "Microsoft.Storage/storageAccounts",
"resourceId": "/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/Contoso/providers/Microsoft.Storage/storageAccounts/diag500",
"portalLink": "https://portal.azure.com/#resource//subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Contoso/providers/Microsoft.Storage/storageAccounts/diag500"
},
"properties": {
"key1": "value1",
"key2": "value2"
}
}
}
Opsgenie によって解析されたペイロード (JSON 形式)
{
"schemaId": "AzureMonitorMetricAlert",
"version": "2.0",
"status": "Activated",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Contoso/providers/microsoft.insights/metricAlerts/StorageCheck",
"name": "StorageCheck",
"description": "",
"condition_type": "SingleResourceMultipleMetricCriteria",
"condition_metric_name": "Transactions",
"condition_dimensions" : "[{name=AccountResourceId, value=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Contoso/providers/Microsoft.Storage/storageAccounts/diag500}, {name=GeoType, value=Primary}]",
"condition_metric_value": "1.0",
"condition_threshold": "0",
"condition_window_size": "PT5M",
"condition_time_aggregation": "PT5M",
"condition_operator": "GreaterThan",
"subscription_id": "00000000-0000-0000-0000-000000000000",
"resource_group_name": "Contoso",
"timestamp": "2018-02-28T10:44:10.1714014Z",
"resource_name": "diag500",
"resource_type": "Microsoft.Storage/storageAccounts",
"resource_id": "/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/Contoso/providers/Microsoft.Storage/storageAccounts/diag500",
"portal_link": "https://portal.azure.com/#resource//subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Contoso/providers/Microsoft.Storage/storageAccounts/diag500"
}
この内容はお役に立ちましたか?