Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Add-AlertRule

Add-AlertRule

microsoft.azure.commands.insights.dll

Synopsis

Adds or updates an alert rule of either metric, event, or webtest type

Syntax

Add-AlertRule [-Operator] [-Threshold] [-ResourceId] [-MetricName] [-TimeAggregationOperator] [-RuleType] [-Location] [-Description] [-DisableRule] [-ResourceGroup] [-Name] [-WindowSize] [-SendToServiceOwners] [-CustomEmails] [-Profile] [<CommonParameters>]

Add-AlertRule [-Operator] [-Threshold] [-ResourceId] [-EventName] [-EventSource] [-Level] [-OperationName] [-ResourceProvider] [-Status] [-SubStatus] [-EmailAddress] [-RuleType] [-Location] [-Description] [-DisableRule] [-ResourceGroup] [-Name] [-WindowSize] [-SendToServiceOwners] [-CustomEmails] [-Profile] [<CommonParameters>]

Add-AlertRule [-FailedLocationCount] [-RuleType] [-Location] [-Description] [-DisableRule] [-ResourceGroup] [-Name] [-WindowSize] [-SendToServiceOwners] [-CustomEmails] [-Profile] [<CommonParameters>]

Detailed Description

Adds or updates an alert rule of either metric, event, or webtest type. The added rule is associated to a resource group and has a name.

Parameters

-Operator <ConditionOperator>

The relational operator for the condition of the rule.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Threshold <Double>

The threshold of the rule.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-ResourceId <String>

The id of the resource the rules is monitoring.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-MetricName <String>

The metric (name) the rule is monitoring. This is only used in metric-based rules.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-TimeAggregationOperator <Nullable`1[TimeAggregationOperator]>

The aggregation operator to apply to the time window when the rule is being evaluated.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-RuleType <AlertRuleTypes>

The type of the rule: Metric, Event, Webtest

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Location <String>

The location where the rule is to be defined.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Description <String>

The description of the rule.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-DisableRule <SwitchParameter>

If present disables the rule. If absent the rule is enabled.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-ResourceGroup <String>

The resource group (name) of the rule

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Name <String>

Name of the rule

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-WindowSize <TimeSpan>

The time window size for the rule to compute its data.

Aliases

None

Required?

false

Position

named

Default value

1 hour

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-SendToServiceOwners <SwitchParameter>

If present instructs the rule to send a notification to the service owners when the rule fires.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-CustomEmails <String[]>

A comma-separated list of e-mail addresses to use when notifying customers about a the rule firing.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Profile <AzureProfile>

In-memory profile (AzureProfile).

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-EventName <String>

The name of the event the rule is monitoring. This is used only in the event-based rules.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-EventSource <String>

The source of the event the rule is monitoring. This is used only in the event-based rules.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Level <String>

The level of the event the rule is monitoring. This is used only in the event-based rules.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-OperationName <String>

The operation name

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-ResourceProvider <String>

The resource provider

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Status <String>

The status

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-SubStatus <String>

The substatus

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-EmailAddress <String>

The e-mail address to use when reporting rule activation.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-FailedLocationCount <Int32>

The failed location count for the webtest rules. This is similar to the threshold in the other types of rules.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

Input Type


Return Type


Notes

Examples

-------------------------- Example 1: AddAlertRule (Metric) --------------------------

This command creates a metric alert rule attached to a website

RequestId StatusCode --------- ---------- 33574ccf-0b01-43b4-aa97-87e6bbcf1c11 Created

add-alertrule -RuleType Metric -Name chiricutin -Location "East US" -ResourceGroup Default-Web-EastUS -Operator GreaterThan -Threshold 2 -WindowSize 00:05:00 -ResourceId /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite -MetricName Requests -Description "Pura Vida" -TimeAggre Total

-------------------------- Example 2: AddAlertRule disabling a rule --------------------------

This command disables a rule. If the rule does not exist, it creates it disabled. If the rule exists, then it just disables it.

RequestId StatusCode --------- ---------- 96c489f1-8529-46e1-a76d-2c1463ca3116 OK

add-alertrule -RuleType Metric -Name chiricutin5 -Location "East US" -ResourceGroup Default-Web-EastUS -Operator GreaterThan -Threshold 2 -WindowSize 00:05:00 -ResourceId /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite -MetricName Requests -TimeAggre Total -CustomE gu@macrosoft.com -send -disab

-------------------------- Example 3: AddAlertRule (Metric) with some actions --------------------------

This command creates a metric alert rule attached to a website and with some e-mails to send notifications to.

RequestId StatusCode --------- ---------- 9a5bc388-c7ac-4dc6-aa70-f4bc29c2c712 OK

add-alertrule -Name chiricutin5 -Location "East US" -ResourceGroup Default-Web-EastUS -Operator GreaterThan -Threshold 1 -ResourceId /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite -MetricName Requests -TimeAggre Total -CustomE gu@macrosoft.com,h@dd.com

Get-AlertHistory
Get-AlertRule
Remove-AlertRule
Online Version