gpt4 book ai didi

Azure 资源管理器警报创建

转载 作者:行者123 更新时间:2023-12-02 23:49:48 25 4
gpt4 key购买 nike

我正在尝试使用 Azure 资源管理器模板在 Application Insights 中创建警报。我遇到的问题是我应该为 resourceUri 设置什么值。我尝试了一些不同的值,我不确定它是否应该是我正在监视的资源或其他资源。该文档是最没有帮助的。当我尝试使用下面的值时,它会出现验证错误。

也不清楚我实际上如何将警报与组件关联起来。它是否应该作为资源嵌套在组件内?我有一个 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": [ "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a4c9c1e4d7cbc9c1d3ccc1d6c18ac7cbc9" rel="noreferrer noopener nofollow">[email protected]</a>" ]
},
"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"
}
}
}
]
}

最佳答案

resourceUrl 应引用以下格式的 Application Insights 服务:

"resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Insights/components/', 'testmetrics')]"

关于Azure 资源管理器警报创建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36758714/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com