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

Notes

ALIASES

COMPLEX PARAMETER PROPERTIES

To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.

ACTION <IPrometheusRuleGroupAction[]>: Actions that are performed when the alert rule becomes active, and when an alert condition is resolved.

  • [ActionGroupId <String>]: The resource id of the action group to use.
  • [ActionProperty <IPrometheusRuleGroupActionProperties>]: The properties of an action group object.
    • [(Any) <String>]: This indicates any property can be added to this object.

ANNOTATION <IPrometheusRuleAnnotations>: 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.

  • [(Any) <String>]: This indicates any property can be added to this object.

LABEL <IPrometheusRuleLabels>: Labels to add or overwrite before storing the result.

  • [(Any) <String>]: This indicates any property can be added to this object.