如何使用 azure CLI 列出所有类型的警报

问题描述 投票:0回答:1

我正在尝试获取为资源组设置的所有警报规则的列表。 (理想情况下,我想获取应用程序的警报规则。但我不确定这是否可能)

我已经能够获取使用这些命令列出的指标警报和日志搜索类型警报:

az monitor metrics alert list --resource-group 'myresourcegroup' --output table
az monitor scheduled-query list --resource-group 'myresourcegroup' --output table

在此资源组中,我还可以看到 Application Insights 智能检测器类型警报,但它们不会显示在任一查询中。我在文档中看不到如何列出此类型的警报规则。有什么想法吗?

谢谢!

azure azure-application-insights azure-cli azure-alerts
1个回答
0
投票

我发现你可以使用 azure powershell 模块来做到这一点。

Get-AzResource -ResourceGroupName "myresourcegroup" -ResourceType Microsoft.AlertsManagement/smartDetectorAlertRules | Format-Table
Get-AzResource -ResourceGroupName "myresourcegroup" -ResourceType microsoft.insights/metricAlerts | Format-Table
Get-AzResource -ResourceGroupName "myresourcegroup" -ResourceType Microsoft.Insights/scheduledQueryRules | Format-Table
© www.soinside.com 2019 - 2024. All rights reserved.