Opsgenie を Microsoft Azure と統合する
概要
メトリック値に関するアラート ルールの場合、指定されたメトリックの値が割り当てられたしきい値を超えると、アラート ルールがアクティブになり、通知が送信されます。イベントに関するアラート ルールの場合、ルールはすべてのイベントについて、または特定の数のイベントが発生した場合にのみ、通知を送信できます。
統合でできるようになること
Azure は、メトリックとイベントに基づいてアラートを生成します。Opsgenie は Azure によって生成されたアラートのディスパッチャーとして機能します。Opsgenie は、メール、テキスト メッセージ (SMS)、電話、Android および iOS のプッシュ通知を使用して、オンコール スケジュールとエスカレーションに基づいて通知する適切なユーザーを決定します。
Opsgenie は、新しい Azure メトリック アラートもサポートしています。Azure の新しいメトリック アラートでは、新しい Azure ペイロードに新しいフィールドが追加されます。そのため、これらをサポートするように統合を設定できます。Azure Monitor のメトリック アラートでサポートされているリソースの詳細はこちらをご確認ください。
統合による機能
Azure でアラートが作成されると、統合によって Opsgenie でアラートが自動で作成されます。
統合をセットアップする
Azure は API ベースの統合です。設定は以下の手順で行います。
Opsgenie で Azure 統合を追加する
Azure で統合を設定する
Azure 統合を追加する
Opsgenie の Free プランまたは Essentials プランを使用している、または Jira Service Management の Standard プランで Opsgenie を使用している場合は、チーム ダッシュボードからのみこの統合を追加できます。 このプランでは、[設定] の [統合] ページが利用できません。
[チーム] に移動して自分のチームを選択します。
左側のナビゲーションで [統合] を選択し、[統合を追加] を選択します。
統合をチーム ダッシュボードから追加すると、そのチーム統合の所有者になります。Opsgenie では、この統合を通じて受信したアラートはそのチームのみに割り当てられます。このセクションの残りの手順に従って、統合を設定してください。
Opsgenie で Azure 統合を追加する方法は以下のとおりです。
[設定] > [統合] の順に移動します。
[統合を追加] を選択します。
検索を実行して「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. Opsgenie で統合を追加する際にコピーした URL を [URI] に貼り付けます。
8. 変更を保存します。
9. 必要に応じて、共通のアラート スキーマを有効にします。
10. [Manage alert rules (アラート ルールの管理)] に移動します。
11. ルールを作成するか、既存のルールを編集します。
12. アラートを作成する条件を追加します。
13. ステップ 5 で作成した Webhook アクション グループを [Action Group (アクション グループ)] セクションに追加します。
14. 変更を保存します。
Opsgenie draggable fields providing support based on Azure schemas
変数 | AzureMonitorMetricAlert | AzureMonitorCommonAlertSchema | Azure Classic |
---|---|---|---|
Subscription ID: {{subscription_id}} | はい | いいえ | はい |
Resource group Name: {{resource_group_name}} | はい | いいえ | はい |
Resource name: {{resource_name}} | はい | いいえ | はい |
ステータス: {{status}} | はい | はい | はい |
ID: {{id}} | はい | はい | はい |
名前: {{name}} | はい | いいえ | はい |
Condition type: {{condition_type}} | はい | はい | はい |
Condition Metric Name: {{condition_metric_name}} | はい | はい | はい |
Condition Metric Namespace: {{condition_metric_namespace}} | いいえ | はい | いいえ |
Condition Metric Unit: {{condition_metric_unit}} | はい | いいえ | はい |
Condition Metric Value: {{condition_metric_value}} | はい | はい | はい |
Condition Threshold: {{condition_threshold}} | はい | はい | はい |
Condition Window Size: {{condition_window_size}} | はい | はい | はい |
Condition Time Aggregation: {{condition_time_aggregation}} | はい | はい | はい |
Condition Operator: {{condition_operator}} | はい | はい | はい |
Resource type: {{resource_type}} | はい | いいえ | はい |
Resource ID: {{resource_id}} | はい | いいえ | はい |
Resource region: {{resource_region}} | いいえ | いいえ | はい |
Portal Link: {{portal_link}} | はい | いいえ | はい |
Version: {{version}} | はい | はい | いいえ |
Dimensions: {{dimensions}} | はい | はい | いいえ |
SchemaId: {{schemaId}} | はい | はい | いいえ |
Dimension List: {{dimensionList}} | はい | はい | いいえ |
Alert Rule: {{alertRule}} | いいえ | はい | いいえ |
Signal Type: {{signalType}} | いいえ | はい | いいえ |
Monitor Condition: {{monitorCondition}} | いいえ | はい | いいえ |
monitoring Service: {{monitoringService}} | いいえ | はい | いいえ |
Alert Target IDs: {{alertTargetIDs}} | いいえ | はい | いいえ |
Fired Date Time: {{firedDateTime}} | いいえ | はい | いいえ |
Resolved Date Time: {{resolvedDateTime}} | いいえ | はい | いいえ |
Essentials Version: {{essentialsVersion}} | いいえ | はい | いいえ |
Alert Context Version: {{alertContextVersion}} | いいえ | はい | いいえ |
AlertId: {{alertId}} | いいえ | はい | いいえ |
Configuration Items: {{configurationItems}} | いいえ | はい | いいえ |
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"
}
Sample payload sent from Azure Monitor Metric Alert Schema (New)
アラート ペイロード (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"
}
Sample payload sent with Azure Monitor Common Alert Schema
{
"schemaId": "azureMonitorCommonAlertSchema",
"data": {
"essentials": {
"alertId": "/subscriptions/0000000-0000-0000-0000-000000000/providers/Microsoft.AlertsManagement/alerts/61dafc88-b4fc-4dea-b335-86081e49f000",
"alertRule": "cpu usage",
"targetResourceType": "microsoft.compute/virtualmachines",
"alertRuleID": "/subscriptions/0000000-0000-0000-0000-000000000/resourceGroups/VirtualMachine4_group/providers/microsoft.insights/metricAlerts/cpu usage",
"severity": "Sev3",
"signalType": "Metric",
"monitorCondition": "Fired",
"targetResourceGroup": "VirtualMachine4_group",
"monitoringService": "Platform",
"alertTargetIDs": [
"/subscriptions/0000000-0000-0000-0000-000000000/resourcegroups/VirtualMachine4_group/providers/microsoft.compute/virtualmachines/VirtualMachine4"
],
"configurationItems": [
"VirtualMachine4"
],
"originAlertId": "0000000-0000-0000-0000-000000000_VirtualMachine4_group_microsoft.insights_metricAlerts_cpu usage_-2033731156",
"firedDateTime": "2025-04-07T14:08:17.4045177Z",
"description": "",
"essentialsVersion": "1.0",
"alertContextVersion": "1.0",
"investigationLink": "https://portal.azure.com/#view/Microsoft_Azure_Monitoring_Alerts/Investigation.ReactView/alertId/%2fsubscriptions%2f0000000-0000-0000-0000-000000000%2fresourceGroups%2fVirtualMachine4_group%2fproviders%2fMicrosoft.AlertsManagement%2falerts%2f61dafc88-b4fc-4dea-b335-86081e49f000"
},
"alertContext": {
"properties": null,
"conditionType": "MultipleResourceMultipleMetricCriteria",
"condition": {
"windowSize": "PT5M",
"allOf": [
{
"metricName": "Percentage CPU",
"metricNamespace": "Microsoft.Compute/virtualMachines",
"operator": "GreaterThan",
"threshold": "20",
"timeAggregation": "Average",
"dimensions": ["Hello1","Hello2"],
"metricValue": 23.202,
"webTestName": null
}
],
"staticThresholdFailingPeriods": {
"numberOfEvaluationPeriods": 0,
"minFailingPeriodsToAlert": 0
},
"windowStartTime": "2025-04-07T14:00:10.212Z",
"windowEndTime": "2025-04-07T14:05:10.212Z"
}
},
"customProperties": null
}
}
Opsgenie によって解析されたペイロード (JSON 形式)
{
"condition_window_size": "PT5M",
"condition_threshold": "20",
"description": "",
"originAlertId": "0000000-0000-0000-0000-000000000_VirtualMachine4_group_microsoft.insights_metricAlerts_cpu usage_-2033731156",
"condition_metric_name": "Percentage CPU",
"resolvedDateTime": "null",
"essentialsVersion": "1.0",
"condition_metric_namespace": "Microsoft.Compute/virtualMachines",
"-alertTargetIDs": ["/subscriptions/0000000-0000-0000-0000-000000000/resourcegroups/VirtualMachine4_group/providers/microsoft.compute/virtualmachines/VirtualMachine4"],
"delayIfDoesNotExists": "true",
"condition_metric_value": "23.202",
"id": "/subscriptions/0000000-0000-0000-0000-000000000/providers/Microsoft.AlertsManagement/alerts/61dafc88-b4fc-4dea-b335-86081e49f000",
"alertId": "/subscriptions/0000000-0000-0000-0000-000000000/providers/Microsoft.AlertsManagement/alerts/61dafc88-b4fc-4dea-b335-86081e49f000",
"-configurationItems": ["VirtualMachine4"],
"severity": "Sev3",
"monitorCondition": "Fired",
"condition_time_aggregation": "Average",
"monitoringService": "Platform",
"alertSource": "com.opsgenie.client.model.dto.ActionSourceCustomDto@509b3abd[domain=integration,sourceType=Azure,sourceName=tester,incomingDataId=25e2962e-b813-4fec-b54c-8d20c3548e59,sourceSubName=Create Alert,customSourceName=<null>,actorUserId=<null>]",
"condition_operator": "GreaterThan",
"condition_type": "MultipleResourceMultipleMetricCriteria",
"alertRule": "cpu usage",
"-dimensionList": ["Hello1","Hello2"],
"version": "1.0",
"alertContextVersion": "1.0",
"schemaId": "azureMonitorCommonAlertSchema",
"signalType": "Metric",
"firedDateTime": "2025-04-07T14:08:17.4045177Z",
"properties": "null",
"status": "Activated",
"dimensions": "["Hello1","Hello2"]"
}
この内容はお役に立ちましたか?