Share via


Get-AlertHistory

Applies To: Azure PowerShell 1.0

Get-AlertHistory

Gets the history of alerts.

Syntax

Parameter Set: Default
Get-AlertHistory [-Caller <String> ] [-DetailedOutput] [-EndTime <DateTime]> ] [-ResourceId <String> ] [-StartTime <DateTime]> ] [-Status <String> ] [ <CommonParameters>]

Detailed Description

The Get-AlertHistory cmdlet gets the history of alerts as they are enabled, disabled, executed, or resolved.

Parameters

-Caller<String>

Specifies a filter by caller. The default value of this parameter is an empty string, which indicates that this cmdlet applies no filter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-DetailedOutput

Indicates that this cmdlet returns detailed output. The default value is $False, which indicates summarized output.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-EndTime<DateTime]>

Specifies the end time, as a DateTime object, of the query in local time. The default value is the current time.

You can use the Get-Date cmdlet to get a DateTime object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-ResourceId<String>

Specifies the resource ID with which the rule is associated.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-StartTime<DateTime]>

Specifies the start time, as a DateTime object, of the query in local time. The default value is the current local time minus one hour.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-Status<String>

Specifies a filter by status. The default value is an empty string, which specifies no filter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Get alert history

This command gets all of the events related to the alert rule that are associated with the current subscription.

PS C:\> Get-AlertHistory -StartTime 2015-02-11T11:00:00 -EndTime 2015-02-11T12:00:00 -DetailedOutput

OUTPUT:
Authorization        :
Caller               : Microsoft.Insights/AlertRules
Claims               : https://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/AlertRules
CorrelationId        : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj
                       cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi
                       LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj
                       LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzg4ODU3OTI5OTI2
Description          : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' has been resolved for Website:
                       PattiFuller01 (Contoso-Web-EastUS)
EventChannels        : Admin, Operation
EventDataId          : 769fab1c-fc9f-4e18-bc3a-fa79fbdd3616
EventName            : Alert
EventSource          : microsoft.insights/AlertRules
EventTimestamp       : 2/11/2015 7:14:45 PM
HttpRequest          :
Id                   : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/events/769fab1c-fc
                       9f-4e18-bc3a-fa79fbdd3616/ticks/635592788857929926
Level                : Informational
OperationId          : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj
                       cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi
                       LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj
                       LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzg4ODU3OTI5OTI2
OperationName        : ResolveAlert
Properties           :
RuleUri              : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d
RuleName             : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d
RuleDescription      :
Threshold            : 3
WindowSizeInMinutes  : 5
Aggregation          : Total
Operator             : GreaterThan
MetricName           : CpuTime
MetricUnit           : Count
ResourceGroupName    : Contoso-Web-EastUS
ResourceProviderName : microsoft.insights
ResourceId           : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d
Status               : Resolved
SubmissionTimestamp  : 2/11/2015 7:14:45 PM
SubscriptionId       : b93fb07a-6f93-30be-bf3e-4f0deca15f4f
SubStatus            :

Authorization        :
Caller               : Microsoft.Insights/AlertRules
Claims               :
                       https://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/AlertRules
CorrelationId        : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj
                       cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi
                       LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj
                       LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0
Description          : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' was activated for Website: PattiFuller01
                       (Contoso-Web-EastUS)
EventChannels        : Admin, Operation
EventDataId          : 66277c94-2097-4f5f-860d-e585f1206cd7
EventName            : Alert
EventSource          : microsoft.insights/AlertRules
EventTimestamp       : 2/11/2015 7:04:46 PM
HttpRequest          :
Id                   : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.web/sites/DavidChew01/events/66277c94-2097-4f5f-860d-e585f1206cd7/ticks/6355927828650595
                       14
Level                : Error
OperationId          : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj
                       cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi
                       LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj
                       LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0
OperationName        : ActivateAlert
Properties           :
RuleUri              : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-
                       EastUS/providers/microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d
RuleName             : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d
RuleDescription      :
Threshold            : 3
WindowSizeInMinutes  : 5
Aggregation          : Total
Operator             : GreaterThan
MetricName           : CpuTime
MetricUnit           : Count
ResourceGroupName    : Contoso-Web-EastUS
ResourceProviderName : microsoft.web
ResourceId           : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.web/sites/DavidChew01
Status               : Activated
SubmissionTimestamp  : 2/11/2015 7:04:46 PM
SubscriptionId       : b93fb07a-6f93-30be-bf3e-4f0deca15f4f
SubStatus            :

Authorization        :
Caller               : Microsoft.Insights/AlertRules
Claims               :
                       https://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/AlertRules
CorrelationId        : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj
                       cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi
                       LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj
                       LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0
Description          : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' was activated for Website: DavidChew01
                       (Contoso-Web-EastUS)
EventChannels        : Admin, Operation
EventDataId          : ec9f7b3c-c6ea-4b45-bd15-ff43e38491e3
EventName            : Alert
EventSource          : microsoft.insights/AlertRules
EventTimestamp       : 2/11/2015 7:04:46 PM
HttpRequest          :
Id                   : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/events/
                       ec9f7b3c-c6ea-4b45-bd15-ff43e38491e3/ticks/635592782865059514
Level                : Error
OperationId          : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj
                       cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi
                       LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj
                       LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0
OperationName        : ActivateAlert
Properties           :
RuleUri              : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d
RuleName             : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d
RuleDescription      :
Threshold            : 3
WindowSizeInMinutes  : 5
Aggregation          : Total
Operator             : GreaterThan
MetricName           : CpuTime
MetricUnit           : Count
ResourceGroupName    : Contoso-Web-EastUS
ResourceProviderName : microsoft.insights
ResourceId           : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d
Status               : Activated
SubmissionTimestamp  : 2/11/2015 7:04:46 PM
SubscriptionId       : b93fb07a-6f93-30be-bf3e-4f0deca15f4f
SubStatus            : 

Example 2: Get the alert history for a specified resource

This command gets the events related to an alert that are associated with the resource identified by ResourceId.

PS C:\> Get-AlertHistory -StartTime 2015-02-11T11:00:00 -EndTime 2015-02-11T12:00:00 -ResourceId '/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d' -DetailedOutput

OUTPUT: 
Authorization        :
Caller               : Microsoft.Insights/AlertRules
Claims               : https://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/AlertRules
CorrelationId        : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj
                       cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi
                       LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj
                       LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzg4ODU3OTI5OTI2
Description          : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' has been resolved for Website:
                       DavidChew01 (Contoso-Web-EastUS)
EventChannels        : Admin, Operation
EventDataId          : 769fab1c-fc9f-4e18-bc3a-fa79fbdd3616
EventName            : Alert
EventSource          : microsoft.insights/AlertRules
EventTimestamp       : 2/11/2015 7:14:45 PM
HttpRequest          :
Id                   : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/events/769fab1c-fc
                       9f-4e18-bc3a-fa79fbdd3616/ticks/635592788857929926
Level                : Informational
OperationId          : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj
                       cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi
                       LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj
                       LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzg4ODU3OTI5OTI2
OperationName        : ResolveAlert
Properties           :
RuleUri              : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d
RuleName             : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d
RuleDescription      :
Threshold            : 3
WindowSizeInMinutes: 5
Aggregation          : Total
Operator             : GreaterThan
MetricName           : CpuTime
MetricUnit           : Count
ResourceGroupName    : Contoso-Web-EastUS
ResourceProviderName : microsoft.insights
ResourceId           : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d
Status               : Resolved
SubmissionTimestamp  : 2/11/2015 7:14:45 PM
SubscriptionId       : b93fb07a-6f93-30be-bf3e-4f0deca15f4f
SubStatus            :

Authorization        :
Caller               : Microsoft.Insights/AlertRules
Claims               : https://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn: Microsoft.Insights/AlertRules
CorrelationId        : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj
                       cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi
                       LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj
                       LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0
Description          : 'CpuTime GreaterThan 3 ([Count]) in the last 5 minutes' was activated for Website: PattiFuller01
                       (Contoso-Web-EastUS)
EventChannels        : Admin, Operation
EventDataId          : ec9f7b3c-c6ea-4b45-bd15-ff43e38491e3
EventName            : Alert
EventSource          : microsoft.insights/AlertRules
EventTimestamp       : 2/11/2015 7:04:46 PM
HttpRequest          :
Id                   : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/events/
                       ec9f7b3c-c6ea-4b45-bd15-ff43e38491e3/ticks/635592782865059514
Level                : Error
OperationId          : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNj
                       cmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2Vi
                       LUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBj
                       LTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NTkyNzgyODY1MDU5NTE0
OperationName        : ActivateAlert
Properties           :
RuleUri              : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d
RuleName             : checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d
RuleDescription      :
Threshold            : 3
WindowSizeInMinutes  : 5
Aggregation          : Total
Operator             : GreaterThan
MetricName           : CpuTime
MetricUnit           : Count
ResourceGroupName    : Contoso-Web-EastUS
ResourceProviderName : microsoft.insights
ResourceId           : /subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/ResourceGroups/Contoso-Web-EastUS/providers/
                       microsoft.insights/AlertRules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d
Status               : Activated
SubmissionTimestamp  : 2/11/2015 7:04:46 PM
SubscriptionId       : b93fb07a-6f93-30be-bf3e-4f0deca15f4f
SubStatus            : 

Add-AlertRule

Get-AlertRule

Remove-AlertRule