我试图使用Azure资源管理器模板在Application Insights中创建警报。我遇到的问题是我应该为resourceUri
投入什么价值。我尝试了一些不同的值,我不确定它是否应该是我正在监控的资源或其他内容。该文档是最无助的。当我尝试使用下面的值时,它给我一个验证错误。Azure资源管理器警报创建
这还不清楚我是如何将警报与组件关联的。它是否应该作为组件内的资源嵌套?我有一个dependsOn
引用组件,但从我的理解,只是确保其他资源被创建第一。
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"resources": [
{
"apiVersion": "2014-04-01",
"type": "Microsoft.Insights/components",
"name": "testmetrics",
"location": "Central US"
},
{
"apiVersion": "2014-04-01",
"type": "Microsoft.Insights/alertrules",
"name": "testAlert1",
"dependsOn": [
"[concat('Microsoft.Insights/components/', 'testmetrics')]"
],
"location": "Central US",
"properties": {
"description": "Test description",
"action": {
"customEmails": [ "[email protected]" ]
},
"condition": {
"failedLocationCount": "1",
"odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
"threshold": "0",
"dataSource": {
"metricName": "BackupFailed",
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
"resourceUri": "/Microsoft.Web/sites/mytestsite"
},
"operator": "GreaterThan",
"windowSize": "1"
}
}
}
]
}
是的,你是对的。 dependsOn仅用于确保首先创建资源。在您的情况下警报规则应取决于应用程序见解服务。 –