观察为活动警报配置的 Azure Monitor 规则。
语法
# Query Azure Monitor alerts v1
# Observe the configured Azure Monitor rules for active alerts.
- task: AzureMonitor@1
inputs:
connectedServiceNameARM: # string. Required. Azure subscription.
ResourceGroupName: # string. Required. Resource group.
# Advanced
filterType: 'none' # 'resource' | 'alertrule' | 'none'. Required. Filter type. Default: none.
#resource: # string. Required when filterType = resource. Resource.
#alertRule: # string. Required when filterType = alertrule. Alert rule.
#severity: 'Sev0,Sev1,Sev2,Sev3,Sev4' # 'Sev0' | 'Sev1' | 'Sev2' | 'Sev3' | 'Sev4'. Severity. Default: Sev0,Sev1,Sev2,Sev3,Sev4.
#timeRange: '1h' # '1h' | '1d' | '7d' | '30d'. Time range. Default: 1h.
#alertState: 'Acknowledged,New' # 'New' | 'Acknowledged' | 'Closed'. Alert state. Default: Acknowledged,New.
#monitorCondition: 'Fired' # 'Fired ' | 'Resolved'. Monitor condition. Default: Fired.
输入
connectedServiceNameARM
-
Azure 订阅
string。 必填。
选择要监视的 Azure 资源管理器订阅。
ResourceGroupName
-
资源组
string。 必填。
提供要监视订阅中的资源组的名称。
filterType
-
筛选器类型
string。 必填。 允许的值:resource(按资源)、alertrule(按警报规则),none。 默认值:none。
按特定资源或警报规则筛选类型。
resource
-
资源
string。
filterType = resource时是必需的。
选择要监视的 Azure 资源。
alertRule
-
警报规则
string。
filterType = alertrule时是必需的。
从当前配置的警报规则中进行选择,以查询状态。
默认值是全部选择。
severity
-
严重性
string。 允许的值:Sev0、Sev1、Sev2、Sev3、Sev4。 默认值:Sev0,Sev1,Sev2,Sev3,Sev4。
按严重性筛选。
timeRange
-
时间范围
string。 允许的值:1h(过去一小时)、1d(过去 24 小时)、7d(过去 7 天)、30d(过去 30 天)。 默认值:1h。
按时间范围筛选。
alertState
-
警报状态
string。 允许的值:New、Acknowledged、Closed。 默认值:Acknowledged,New。
按警报实例的状态筛选。
monitorCondition
-
监视条件
string。 允许的值:Fired (已触发),Resolved。 默认值:Fired。
表示基础条件是否已超过定义的警报规则阈值。
任务控制选项
除任务输入之外,所有任务都具有控制选项。 有关详细信息,请参阅 控件选项和常见任务属性。
输出变量
没有。
注解
若要观察为活动警报配置的 Azure Monitor 规则,请使用发布管道 无代理作业 此任务。
注释
此任务只能在发布管道的 无代理作业 中使用。
如果在采样时未激活任何警报规则,则任务会成功。
有关使用此任务的详细信息,请参阅 审批和入口概述。