你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

New-AzPrometheusRuleObject

Create an in-memory object for PrometheusRule.

Syntax

New-AzPrometheusRuleObject
   -Expression <String>
   [-Action <IPrometheusRuleGroupAction[]>]
   [-Alert <String>]
   [-Annotation <IPrometheusRuleAnnotations>]
   [-Enabled <Boolean>]
   [-For <TimeSpan>]
   [-Label <IPrometheusRuleLabels>]
   [-Record <String>]
   [-ResolveConfigurationAutoResolved <Boolean>]
   [-ResolveConfigurationTimeToResolve <TimeSpan>]
   [-Severity <Int32>]
   [<CommonParameters>]

Description

Create an in-memory object for PrometheusRule.

Examples

Example 1: Create an in-memory object for PrometheusRule.

New-AzPrometheusRuleObject -Record "job_type:billing_jobs_duration_seconds:99p5m" -Expression 'histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service="billing-processing"}[5m])) by (job_type))'

Alert Enabled Expression
----- ------- ----------
              histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service="billing-processing"}[5m])) by (job_type))'

Create an in-memory object for PrometheusRule.

Parameters

-Action

Actions that are performed when the alert rule becomes active, and when an alert condition is resolved. To construct, see NOTES section for ACTION properties and create a hash table.

Type:IPrometheusRuleGroupAction[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Alert

Alert rule name.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Annotation

The annotations clause specifies a set of informational labels that can be used to store longer additional information such as alert descriptions or runbook links. The annotation values can be templated. To construct, see NOTES section for ANNOTATION properties and create a hash table.

Type:IPrometheusRuleAnnotations
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Enabled

Enable/disable rule.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Expression

The PromQL expression to evaluate. https://prometheus.io/docs/prometheus/latest/querying/basics/. Evaluated periodically as given by 'interval', and the result recorded as a new set of time series with the metric name as given by 'record'.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-For

The amount of time alert must be active before firing.

Type:TimeSpan
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Label

Labels to add or overwrite before storing the result. To construct, see NOTES section for LABEL properties and create a hash table.

Type:IPrometheusRuleLabels
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Record

Recorded metrics name.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResolveConfigurationAutoResolved

Enable alert auto-resolution.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResolveConfigurationTimeToResolve

Alert auto-resolution timeout.

Type:TimeSpan
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Severity

The severity of the alerts fired by the rule. Must be between 0 and 4.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

PrometheusRule