azure - 如何在azure资源模板中编写带有新警报的Web测试?

标签 azure alert azure-resource-manager

将经典警报迁移到新警报。

我在 Azure 可用性测试中有一个 ping URL“Microsoft.Insights/webtest”。

旧的警报类型是“Microsoft.Insights/alertrules”。

条件类型为“Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition”。

旧的 metricName 是“GSMT_AvRaW”。

如何在arm中编写这个新警报(近实时)或如何写入arm中的webtests?

当我在可用性中添加新测试时,我可以将警报类型经典切换为近实时。它将生成警报

AddNewTestAlert

而且我无法为网络测试添加新警报条件,我只能单击编辑警报按钮来编辑警报。因为当我添加新的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/

相关文章:

swift - 如何处理 swift 3 中的错误?

Azure 资源组不可用于已部署的资源

Azure Powershell 安全 secret 值

azure - 并行安装不同的 Azure 模拟器

azure - azure 应用程序服务中的响应时间出现异常峰值

azure - 能否在 Azure AD B2C 自定义策略中的步骤之间传递密码声明?

azure - 使用 ARM 模板在 Azure SQL DB 上设置透明数据加密

azure - 设置 Azure 主题的重试策略

java - 搜索 Java 应用程序的免费警报框架

javascript - IE 的奇怪 ajax 问题