Azure Monitor Application Insights スマート検出をアラートに移行する (プレビュー)

この記事では、Application Insights スマート検出をアラートに移行するプロセスについて説明します。 移行によって、さまざまなスマート検出モジュールのアラート ルールが作成されます。 これらのルールは、他の Azure Monitor アラート ルールと同じように管理および構成できます。 新しい検出に関するアクションや通知を行う複数の方法を取得するために、これらのルールのアクション グループを構成することもできます。

アラートに移行する利点

移行により、スマート検出では、次のような Azure Monitor アラートのすべての機能を活用できるようになります。

  • すべての検出機能のための豊富な通知オプション: アクション グループを使用して、アラートの発生時にトリガーされる複数の種類の通知とアクションを構成します。 通知は、メール、SMS、音声通話、またはプッシュ通知で構成できます。 セキュリティで保護された Webhook、ロジック アプリ、Automation Runbook の呼び出しなどのアクションを構成できます。 アクション グループを使用すると、アクションを一度構成して複数のアラート ルールで使用できるようにすることで、大規模な管理が促進されます。
  • 大規模な管理: スマート検出のアラートは、Azure Monitor アラートのエクスペリエンスと API を使用します。
  • 通知のルールベースの抑制: アクション ルールを使用して、Azure Resource Manager の任意のスコープ (Azure サブスクリプション、リソース グループ、ターゲット リソースなど) で、アクションを定義または抑制します。 フィルターは、操作するアラート インスタンスを特定のサブセットに絞り込むのに便利です。

移行されるスマート検出機能

Application Insights リソースの移行時に、新しい一連のアラート ルールが作成されます。 移行されるスマート検出機能ごとに 1 つのルールが作成されます。 移行前のスマート検出機能と移行後のアラート ルールの対応を次の表に示します。

スマート検出ルール名 (1) アラート ルール名 (2)
サーバー応答速度の低下 応答待機時間の劣化 - "<Application Insights のリソース名>"
依存関係の期間の減少 依存関係の待機時間の劣化 - "<Application Insights のリソース名>"
トレースの重大度の比率の低下 (プレビュー) トレース重大度の劣化 - "<Application Insights のリソース名>"
例外数の異常な上昇 (プレビュー) 例外の異常 - "<Application Insights のリソース名>"
Potential memory leak detected (潜在的なメモリ リークの検出) (プレビュー) メモリ リークの可能性 - "<Application Insights のリソース名>"
ページの読み込み速度が遅い サポートされなくなりました (3)
サーバーの応答速度が遅い サポートされなくなりました (3)
依存関係の期間が長い サポートされなくなりました (3)
Potential security issue detected (潜在的なセキュリティの問題の検出) (プレビュー) サポートされなくなりました (3)
日次データ ボリュームの異常な上昇 (プレビュー) サポートされなくなりました (3)

(1) スマート検出の [設定] ペインに表示されるルールの名前。
(2) 移行後の新しいアラート ルールの名前。
(3) これらのスマート検出機能は、使用率と、検出の有効性の再評価が低かったため、アラートに変換されません。 これらの検出機能は、このリソースの移行が完了すると、それに対してサポートされなくなります。

注意

エラーの異常スマート検出機能は既にアラート ルールとして作成されているため、移行は必要ありません。 この記事では説明されません。

移行によって、アルゴリズムの設計とスマート検出の動作が変更されることはありません。 変更の前後で、同じ検出のパフォーマンスを期待できます。

Application Insights の各リソースへの移行を個別に適用する必要があります。 明示的に移行されないリソースについては、スマート検出は以前と同様に引き続き動作します。

新しいスマート検出アラート ルールのアクション グループの構成

移行の一環として、新しいアラート ルールがそれぞれアクション グループで自動的に構成されます。 移行では、各ルールの既定のアクション グループを割り当てることができます。 既定のアクション グループは、移行前のルールの通知に従って構成されます。

  • スマート検出ルールに既定のメールが設定されているか、通知が構成されていない場合、新しいアラート ルールは "Application Insights スマート検出" という名前のアクション グループで構成されます。

    • 移行ツールでその名前の既存のアクション グループが検出された場合は、新しいアラート ルールがそのアクション グループにリンクされます。
    • それ以外の場合は、その名前の新しいアクション グループが作成されます。 "Azure Resource Manager のロールへのメール" アクション用に新しいグループが構成され、Azure Resource Manager の監視共同作成者および監視閲覧者ユーザーに通知を送信します。
  • 移行前に既定のメール通知が変更されていた場合は、前に構成されていたメール アドレスに通知を送信するメール アクションとともに "Application Insights スマート検出 <n>" というアクション グループが作成されます。

既定のアクション グループを使用するのではなく、すべての新しいアラート ルールに対して構成される既存のアクション グループを選択します。

スマート検出の移行プロセスを実行する

Azure portal、Azure CLI、または Azure Resource Manager テンプレート (ARM テンプレート) を使用して、移行を実行します。

Azure portal を使用してスマート検出を移行する

リソース内のスマート検出を移行するには:

  1. Application Insights リソースの [調査] 見出しの下にある [スマート検出] を選択します。

  2. [Migrate smart detection to alerts (Preview)] (スマート検出をアラートに移行する (プレビュー)) を選択します。 移行ダイアログが表示されます。

    Screenshot that shows the Smart Detection feed banner.

  3. [このサブスクリプションのすべての Application Insights リソースを移行する] オプションを選択します。 現在使用中のリソースのみを移行する場合は、このオプションをオフのままにすることもできます。

    注意

    このオプションをオンにすると、まだ移行されていないすべての既存 Application Insights リソースが影響を受けます。 アラートへの移行がプレビュー段階である限り、新しい Application Insights リソースは、アラートのないスマート検出を使用して作成されます。

  4. 新しいアラート ルール用に構成するアクション グループを選択します。 前述したように既定のアクション グループを使用することも、既存のアクション グループのいずれかを使用することもできます。

  5. [移行] を選択して、移行処理を開始します。

    Screenshot that shows the Smart Detection migration dialog.

移行後、前述のように Application insights リソースに対して新しいアラート ルールが作成されます。

Azure CLI を使用してスマート検出を移行する

次の Azure CLI コマンドを使用して、スマート検出の移行を開始します。 前に説明したように、このコマンドは、事前に構成された移行プロセスをトリガーします。

az rest --method POST --uri /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/migrateFromSmartDetection?api-version=2021-01-01-preview --body @body.txt

1つの Application Insights リソースを移行するには、"body.txt" に次のものを含めます。

{
      "scope": [
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}"
      ],
      "actionGroupCreationPolicy" : "{Auto/Custom}",
      "customActionGroupName" : "{actionGroupName}"           
}

サブスクリプション内のすべての Application Insights リソースを移行するには、"body.txt" に次のものを含めます。

{
      "scope": [
	"/subscriptions/{subscriptionId} "
      ],
      "actionGroupCreationPolicy" : "{Auto/Custom}",
      "customActionGroupName" : "{actionGroupName}"           
}

ActionGroupCreationPolicy パラメーターは、スマート検出のルールのメール設定をアクション グループに移行するためのポリシーを選択します。 使用できる値は、以下のとおりです。

  • 自動: このドキュメントで説明されているように、既定のアクション グループを使用します。
  • カスタム: customActionGroupName で指定されたアクション グループを使用して、すべてのアラート ルールを作成します。
  • <空白>: ActionGroupCreationPolicy が指定されていない場合は、Auto ポリシーが使用されます。

ARM テンプレートを使用してスマート検出を移行する

ARM テンプレートを使用して、特定の Application Insights リソースのアラートへのスマート検出の移行をトリガーできます。 この方法を使用するには、次が必要です。

  • サポートされている検出機能ごとに、スマート検出のアラート ルールを作成します。
  • 移行が完了したことを示すために、Application insights のプロパティを変更します。

この方法では、作成するアラート ルールの制御、独自のアラート ルール名と説明の定義、ルールごとに必要なアクション グループの選択を実施できます。

この目的には、次のテンプレートを使用します。 必要に応じて編集して、サブスクリプション ID と Application Insights リソース名を指定してください。

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
	"parameters": {
		"applicationInsightsResourceName": {
			"type": "string"
		},
		"actionGroupName": {
			"type": "string",
			"defaultValue": "Application Insights Smart Detection"
		},
		"actionGroupResourceGroup": {
			"type": "string",
			"defaultValue": "[resourceGroup().Name]"
		}
	},
	"variables": {
		"applicationInsightsResourceId": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',resourceGroup().Name,'/providers/microsoft.insights/components/',parameters('applicationInsightsResourceName'))]",
		"actionGroupId": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',parameters('actionGroupResourceGroup'),'/providers/microsoft.insights/ActionGroups/',parameters('actionGroupName'))]",
		"requestPerformanceDegradationDetectorRuleName": "[concat('Response Latency Degradation - ', parameters('applicationInsightsResourceName'))]",
		"dependencyPerformanceDegradationDetectorRuleName": "[concat('Dependency Latency Degradation - ', parameters('applicationInsightsResourceName'))]",
		"traceSeverityDetectorRuleName": "[concat('Trace Severity Degradation - ', parameters('applicationInsightsResourceName'))]",
		"exceptionVolumeChangedDetectorRuleName": "[concat('Exception Anomalies - ', parameters('applicationInsightsResourceName'))]",
		"memoryLeakRuleName": "[concat('Potential Memory Leak - ', parameters('applicationInsightsResourceName'))]"
	},
	"resources": [
		{
			"name": "[variables('requestPerformanceDegradationDetectorRuleName')]",
			"type": "Microsoft.AlertsManagement/smartdetectoralertrules",
			"location": "global",
			"apiVersion": "2019-03-01",
			"properties": {
				"description": "Response Latency Degradation notifies you of an unusual increase in latency in your app response to requests.",
				"state": "Enabled",
				"severity": "Sev3",
				"frequency": "PT24H",
				"detector": {
					"id": "RequestPerformanceDegradationDetector"
				},
				"scope": [
					"[variables('applicationInsightsResourceId')]"
				],
				"actionGroups": {	
					"groupIds": [
						"[variables('actionGroupId')]"
					]
				}
			}
		},
		{
			"name": "[variables('dependencyPerformanceDegradationDetectorRuleName')]",
			"type": "Microsoft.AlertsManagement/smartdetectoralertrules",
			"location": "global",
			"apiVersion": "2019-03-01",
			"properties": {
				"description": "Dependency Latency Degradation notifies you of an unusual increase in response by a dependency your app is calling (e.g. REST API or database)",
				"state": "Enabled",
				"severity": "Sev3",
				"frequency": "PT24H",
				"detector": {
					"id": "DependencyPerformanceDegradationDetector"
				},
				"scope": [
					"[variables('applicationInsightsResourceId')]"
				],
				"actionGroups": {
					"groupIds": [
						"[variables('actionGroupId')]"
					]
				}
			}
		},
		{
			"name": "[variables('traceSeverityDetectorRuleName')]",
			"type": "Microsoft.AlertsManagement/smartdetectoralertrules",
			"location": "global",
			"apiVersion": "2019-03-01",
			"properties": {
				"description": "Trace Severity Degradation notifies you of an unusual increase in the severity of the traces generated by your app.",
				"state": "Enabled",
				"severity": "Sev3",
				"frequency": "PT24H",
				"detector": {
					"id": "TraceSeverityDetector"
				},
				"scope": [
					"[variables('applicationInsightsResourceId')]"
				],
				"actionGroups": {
					"groupIds": [
						"[variables('actionGroupId')]"
					]
				}
			}
		},
		{
			"name": "[variables('exceptionVolumeChangedDetectorRuleName')]",
			"type": "Microsoft.AlertsManagement/smartdetectoralertrules",
			"location": "global",
			"apiVersion": "2019-03-01",
			"properties": {
				"description": "Exception Anomalies notifies you of an unusual rise in the rate of exceptions thrown by your app.",
				"state": "Enabled",
				"severity": "Sev3",
				"frequency": "PT24H",
				"detector": {
					"id": "ExceptionVolumeChangedDetector"
				},
				"scope": [
					"[variables('applicationInsightsResourceId')]"
				],
				"actionGroups": {
					"groupIds": [
						"[variables('actionGroupId')]"
					]
				}
			}
		},
		{
			"name": "[variables('memoryLeakRuleName')]",
			"type": "Microsoft.AlertsManagement/smartdetectoralertrules",
			"location": "global",
			"apiVersion": "2019-03-01",
			"properties": {
				"description": "Potential Memory Leak notifies you of increased memory consumption pattern by your app which may indicate a potential memory leak.",
				"state": "Enabled",
				"severity": "Sev3",
				"frequency": "PT24H",
				"detector": {
					"id": "MemoryLeakDetector"
				},
				"scope": [
					"[variables('applicationInsightsResourceId')]"
				],
				"actionGroups": {
					"groupIds": [
						"[variables('actionGroupId')]"
					]
				}
			}
		},
		{
			"name": "[concat(parameters('applicationInsightsResourceName'),'/migrationToAlertRulesCompleted')]",
			"type": "Microsoft.Insights/components/ProactiveDetectionConfigs",
			"location": "[resourceGroup().location]",
			"apiVersion": "2018-05-01-preview",
			"properties": {
				"name": "migrationToAlertRulesCompleted",
				"sendEmailsToSubscriptionOwners": false,
				"customEmails": [],
				"enabled": true
			},
			"dependsOn": [
				"[resourceId('Microsoft.AlertsManagement/smartdetectoralertrules', variables('requestPerformanceDegradationDetectorRuleName'))]",
				"[resourceId('Microsoft.AlertsManagement/smartdetectoralertrules', variables('dependencyPerformanceDegradationDetectorRuleName'))]",
				"[resourceId('Microsoft.AlertsManagement/smartdetectoralertrules', variables('traceSeverityDetectorRuleName'))]",
				"[resourceId('Microsoft.AlertsManagement/smartdetectoralertrules', variables('exceptionVolumeChangedDetectorRuleName'))]",
				"[resourceId('Microsoft.AlertsManagement/smartdetectoralertrules', variables('memoryLeakRuleName'))]"
			]
		}
	]
}

移行後にアラートを表示する

移行後に、Application Insights リソースの [アラート] エントリを選択すると、スマート検出のアラートを表示できます。 [シグナルの種類][スマート検出機能] を選択して、フィルターを適用し、スマート検出のアラートのみを表示します。 アラートを選択すると、その検出の詳細が表示されます。

Screenshot that shows smart detection alerts.

Application Insights リソースの [スマート検出] フィードで利用可能な検出を確認することもできます。

Screenshot that shows the Smart Detection feed.

移行後にスマート検出のアラート ルールの設定を管理する

移行後に Azure portal または ARM テンプレートを使用して、スマート検出のアラート ルールの設定を管理します。

Azure portal を使用してアラート ルールの設定を管理する

移行の終了後、リソースに対して定義されている他のアラート ルールと同様の方法で、新しいスマート検出のアラート ルールにアクセスします。

  1. Application Insights リソースの [監視] 見出しの下にある [アラート] を選択します。

    Screenshot that shows the Alerts menu.

  2. [アラート ルールの管理] を選択します。

    Screenshot that shows Manage alert rules.

  3. [シグナルの種類][スマート検出機能] を選択して、フィルターを適用し、スマート検出のアラート ルールを表示します。

    Screenshot that shows smart detection rules.

スマート検出のアラート ルールを有効または無効にする

スマート検出のアラート ルールは、他のアラート ルールと同様に、ポータルの UI またはプログラムを使用して有効または無効にできます。

移行前に特定のスマート検出のルールが無効にされていた場合は、新しいアラート ルールも無効になります。

アラート ルールにアクション グループを構成する

新しいスマート検出のアラート ルールのアクション グループは、他の Azure Monitor のアラート ルールと同様に作成および管理できます。

ARM テンプレートを使用してアラート ルールの設定を管理する

移行の終了後、ARM テンプレートを使用して、スマート検出のアラート ルールの設定を構成できます。

注意

移行の終了後、スマート検出の設定は、スマート検出のアラート ルール テンプレートを使用して構成する必要があります。 Application Insights Resource Manager テンプレートを使用して構成することはできなくなります。

この ARM テンプレートの例は、Enabled 状態の Response Latency Degradation アラート ルールを重大度 2 で構成する方法を示します。

  • スマート検出はグローバル サービスであるため、ルールは global な場所に作成されます。

  • id プロパティは、構成されている特定の検出機能に合わせて変更する必要があります。 値は次のいずれかである必要があります。

    • FailureAnomaliesDetector
    • RequestPerformanceDegradationDetector
    • DependencyPerformanceDegradationDetector
    • ExceptionVolumeChangedDetector
    • TraceSeverityDetector
    • MemoryLeakDetector
{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "resources": [
        {
            "type": "microsoft.alertsmanagement/smartdetectoralertrules",
            "apiVersion": "2019-03-01",
            "name": "Response Latency Degradation - my-app",
            "location": "global", 
            "properties": {
                  "description": "Response Latency Degradation notifies you of an unusual increase in latency in your app response to requests.",
                  "state": "Enabled",
                  "severity": "2",
                  "frequency": "PT24H",
                  "detector": {
                  "id": "RequestPerformanceDegradationDetector"
                  },
                  "scope": ["/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/microsoft.insights/components/my-app"],
                  "actionGroups": {
                        "groupIds": ["/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/MyResourceGroup/providers/microsoft.insights/actiongroups/MyActionGroup"]
                  }
            }
        }
    ]
}

次のステップ