我们过去已经编写并配置了可用性测试警报,这些警报显示在CLASSIC ALERTS下:
https://portal.azure.com/#blade/Microsoft_Azure_Monitoring/AlertsBlade Following is one example of it for a WEBTEST Alert
"name": "[variables('webtest-CMS-http')]", "description": "Alert for availability test", "isEnabled": true, "condition": { "$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.LocationThresholdRuleCondition, Microsoft.WindowsAzure.Management.Mon.Client", "odata.type": "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition", "dataSource": { "$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('webtest-CMS-http'))]", "metricName": "GSMT_AvRaW" }, "windowSize": "PT5M", "failedLocationCount": 3 }, "actions": [ { "$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, Microsoft.WindowsAzure.Management.Mon.Client", "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", "sendToServiceOwners": false, "customEmails": "[array(parameters('webTestEmails'))]" }
我试图找到一些文档,以了解如何使用新的ALERT规则(而不是经典规则)重新编写这些Alert规则。我确实在门户网站中看到一个选项,要求将规则从经典迁移到新,但是我们可以在某处使用JSON ARM模板方法吗?有人可以帮我提供一个工作样品吗?我确实在这里找到了此讨论,但是想要一个可用性警报示例:-Application insights alerts using ARM templates
答案 0 :(得分:0)
除了从Azure门户尝试Migration tool之外,还可以参考this文档中提到的示例模板,甚至可以从Azure门户导出模板以检查表示形式。以下模板对我有用:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"metricalerts_test_new_alerts_test_log_analytics_name": {
"defaultValue": "test-new-alerts-test-log-analytics",
"type": "String"
},
"webtests_test_new_alerts_test_log_analytics_externalid": {
"defaultValue": "/subscriptions/xxxxx-xxxx-xxx-xxx-xxxxxxxx/resourceGroups/alertrg/providers/microsoft.insights/webtests/test-new-alerts-test-log-analytics",
"type": "String"
},
"components_test_log_analytics_externalid": {
"defaultValue": "/subscriptions/xxxxx-xxxx-xxx-xxx-xxxxxxxx/resourceGroups/alertrg/providers/microsoft.insights/components/test-log-analytics",
"type": "String"
}
},
"variables": {},
"resources": [
{
"type": "microsoft.insights/metricalerts",
"apiVersion": "2018-03-01",
"name": "[parameters('metricalerts_test_new_alerts_test_log_analytics_name')]",
"location": "global",
"tags": {
"hidden-link:/subscriptions/xxxxx-xxxx-xxx-xxx-xxxxxxxx/resourcegroups/alertrg/providers/microsoft.insights/components/test-log-analytics": "Resource",
"hidden-link:/subscriptions/xxxxx-xxxx-xxx-xxx-xxxxxxxx/resourcegroups/alertrg/providers/microsoft.insights/webtests/test-new-alerts-test-log-analytics": "Resource"
},
"properties": {
"description": "[concat('Automatically created alert rule for availability test \"', parameters('metricalerts_test_new_alerts_test_log_analytics_name'), '\"')]",
"severity": 1,
"enabled": true,
"scopes": [
"[parameters('webtests_test_new_alerts_test_log_analytics_externalid')]",
"[parameters('components_test_log_analytics_externalid')]"
],
"evaluationFrequency": "PT1M",
"windowSize": "PT5M",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria"
},
"actions": []
}
}
]
}
希望这会有所帮助!
注意:经典警报迁移的停用日期已从最初宣布的2019年6月30日延长至2019年8月31日。