gpt4 book ai didi

powershell - 将警报规则添加到 Azure 云服务时出错

转载 作者:行者123 更新时间:2023-12-01 05:01:03 25 4
gpt4 key购买 nike

我创建了一个脚本来向多个 Azure 资源(Web 应用、SQL 数据库和云服务)添加警报规则。除了创建返回错误的云服务警报之外,一切正常:

Add-AlertRule : ResourceProviderNotSupported: The resource provider 'Microsoft.ClassicCompute' is not supported.

这是我用来添加规则的脚本:

$cloudServices = Get-AzureResource -ResourceType "Microsoft.ClassicCompute/domainNames" -ResourceGroupName $resourceGroup

Foreach ($cloudService in $cloudServices)
{
# Cloud Service - CPU Percentage
Add-AlertRule `
-RuleType Metric `
-Name "CPU Percentage (Cloud Service)" `
-Location $cloudService.Location `
-ResourceGroup $cloudService.ResourceGroupName `
-Operator GreaterThan `
-Threshold 75 `
-WindowSize 01:00:00 `
-ResourceId $cloudService.ResourceId `
-MetricName "Percentage CPU" `
-TimeAggregationOperator Average `
-SendToServiceOwners
}

我尝试过使用不同的 ResourceType 参数来定位角色而不是云服务,但这也不起作用。

有人有成功编写这些云服务警报脚本的经验吗?

最佳答案

关于powershell - 将警报规则添加到 Azure 云服务时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32654011/

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