【问题标题】:Error adding Alert Rule to Azure Cloud Service向 Azure 云服务添加警报规则时出错
【发布时间】:2015-12-15 17:17:44
【问题描述】:

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

Add-AlertRule : ResourceProviderNotSupported: 资源提供者 不支持“Microsoft.ClassicCompute”。

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

$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 monitoring


    【解决方案1】:

    【讨论】:

    • 谢谢。我之前看过您的博文,但我希望使用 ResourceManager PowerShell 模块而不是调用 REST API。我们也没有使用您的脚本需要的 PS 4.0。话虽如此,我尝试根据您在脚本中使用的内容调整 ResourceId,但我仍然遇到同样的错误。
    • 此答案不包含您认为有用的信息。现在它只包含一个链接。请使用相关信息更新答案。
    猜你喜欢
    • 2013-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-04
    • 1970-01-01
    • 2016-04-27
    • 2019-02-03
    • 1970-01-01
    相关资源
    最近更新 更多