web测试中未启用Azure ARM模板中的警报规则
我正在使用ARM模板以编程方式创建Application Insights web测试和警报规则。ARM模板基于 web测试和警报规则都已创建,但web测试的警报属性已禁用。警报规则列在警报规则刀片上,但不是列在网络测试部分,而是列在其他部分,请参见图片: 要获得启用警报的web测试,我缺少什么 ARM模板(SO删除了web测试中未启用Azure ARM模板中的警报规则,azure,azure-resource-manager,Azure,Azure Resource Manager,我正在使用ARM模板以编程方式创建Application Insights web测试和警报规则。ARM模板基于 web测试和警报规则都已创建,但web测试的警报属性已禁用。警报规则列在警报规则刀片上,但不是列在网络测试部分,而是列在其他部分,请参见图片: 要获得启用警报的web测试,我缺少什么 ARM模板(SO删除了WebTest属性的值): { “$schema”:”http://schema.management.azure.com/schemas/2015-01-01/deployme
WebTest
属性的值):
{
“$schema”:”http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
“内容版本”:“1.0.0.0”,
“参数”:{
“webTestName”:{
“类型”:“字符串”
},
“appName”:{“type”:“string”}
},
“变量”:{
“url”:”http://www.google.com",
“testName”:“[concat(参数('webTestName'),'-',toLower(参数('appName')))]”,
“alertRuleName”:“[concat(参数('webTestName'),'-',toLower(参数('appName')),'-',subscription().subscriptionId)]”
},
“资源”:[
{
“名称”:“[参数('appName')]”,
“类型”:“Microsoft.Insights/components”,
“apiVersion”:“2014-04-01”,
“种类”:“网络”,
“地点”:“美国中部”,
“财产”:{
“应用程序类型”:“web”,
“流量类型”:“红色字段”,
“请求来源”:“未知”,
“名称”:“[参数('appName')]”,
“PackageId”:空,
“应用程序ID:“[参数('appName')]”
},
“标签”:{
“应用程序类型”:“web”
}
},
{
“名称”:“[变量('testName')]”,
“apiVersion”:“2014-04-01”,
“类型”:“microsoft.insights/webtests”,
“地点”:“美国中部”,
“dependsOn”:[
[resourceId('Microsoft.Insights/components',parameters('appName'))]
],
“标签”:{
[concat('hidden-link:',resourceId('Microsoft.Insights/components',parameters('appName'))]:“资源”
},
“财产”:{
“名称”:“[参数('webTestName')]”,
“说明”:“说明”,
“启用”:正确,
“频率”:300,
“超时”:120,
“善良”:“平”,
“RetryEnabled”:true,
“地点”:[
{
“Id”:“us-il-ch1-azr”
},
{
“Id”:“emea东南部sto边缘”
},
{
“Id”:“emea nl ams azr”
}
],
“配置”:{
“网络测试”:“[concat(“”)]”
},
“SyntheticMonitorId:“[变量('testName')]”
}
},
{
“名称”:“[变量('alertRuleName')]”,
“apiVersion”:“2014-04-01”,
“类型”:“Microsoft.Insights/alertrules”,
“地点”:“美国东部”,
“dependsOn”:[
[resourceId('Microsoft.Insights/webtests',variables('testName'))]
],
“标签”:{
“[concat('hidden-link:',resourceId('microsoft.insights/components',parameters('appName'))]”:“Resource”,
[concat('hidden-link:',resourceId('microsoft.insights/webtests',variables('testName'))]:“资源”
},
“财产”:{
“名称”:“[变量('alertRuleName')]”,
“说明”:“可用性测试警报”,
“isEnabled”:没错,
“条件”:{
“$type”:“Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.LocationThresholdRuleCondition,Microsoft.WindowsAzure.Management.Mon.Client”,
“odata.type”:“Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition”,
“数据源”:{
“$type”:“Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource,Microsoft.WindowsAzure.Management.Mon.Client”,
“odata.type”:“Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource”,
“resourceUri”:“[resourceId('microsoft.insights/webtests',variables('testName'))]”,
“metricName”:“GSMT_AvRaW”
},
“窗口大小”:“PT5M”,
“failedLocationCount”:2
},
“行动”:[
{
“$type”:“Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction,Microsoft.WindowsAzure.Management.Mon.Client”,
“odata.type”:“Microsoft.Azure.Management.Insights.Models.RuleEmailAction”,
“sendToServiceOwners”:正确,
“自定义电子邮件”:[]
}
]
}
}
]
}
原来
resourceUri
的值是区分大小写的。解决方案:
"variables": {
...
"testName": "[toLower(concat(parameters('webTestName'), '-', toLower(parameters('appName'))))]",
"alertRuleName": "[toLower(concat(parameters('webTestName'), '-', toLower(parameters('appName')), '-', subscription().subscriptionId))]"
},
"variables": {
...
"testName": "[toLower(concat(parameters('webTestName'), '-', toLower(parameters('appName'))))]",
"alertRuleName": "[toLower(concat(parameters('webTestName'), '-', toLower(parameters('appName')), '-', subscription().subscriptionId))]"
},