将经典警报迁移到新警报。
我在 Azure 可用性测试中有一个 ping URL“Microsoft.Insights/webtest”。
旧的警报类型是“Microsoft.Insights/alertrules”。
条件类型为“Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition”。
旧的 metricName 是“GSMT_AvRaW”。
如何在arm中编写这个新警报(近实时)或如何写入arm中的webtests?
当我在可用性中添加新测试时,我可以将警报类型经典切换为近实时。它将生成警报
而且我无法为网络测试添加新警报条件,我只能单击编辑警报按钮来编辑警报。因为当我添加新的Alert时,Condition中无法选择Metric Type。
最佳答案
如果您查看资源浏览器并导航到手动创建的(近实时)警报,您应该会看到如下定义的“critera”对象。这是一个似乎有效的资源的完整示例。为每个值创建一些变量:
{
"type": "Microsoft.Insights/metricAlerts",
"apiVersion": "2018-03-01",
"name": "[variables('alertName')]",
"location": "global",
"dependsOn": [],
"tags": {
"[concat('hidden-link:', variables('applicationInsightsResourceId'))]": "Resource",
"[concat('hidden-link:', variables('webtestResourceId'))]": "Resource"
},
"properties": {
"description": "[concat('Alert for ', parameters('availibilityTestName'))]",
"severity": 4,
"enabled": true,
"scopes": [
"[variables('webtestResourceId')]",
"[variables('applicationInsightsResourceId')]"
],
"evaluationFrequency": "PT5M",
"windowSize": "PT15M",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria",
"webTestId": "[variables('webtestResourceId')]",
"componentId": "[variables('applicationInsightsResourceId')]",
"failedLocationCount": 3
},
"actions": [
{
"actionGroupId": "[resourceId('microsoft.insights/actiongroups', 'webhook')]",
"webHookProperties": {
// Some properties to send to webhook
}
}
]
}
}
关于azure - 如何在azure资源模板中编写带有新警报的Web测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54646152/