Get-AzMetricAlertRuleV2
取得 V2 (非傳統) 計量警示規則
語法
Get-AzMetricAlertRuleV2
[-ResourceGroupName <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzMetricAlertRuleV2
-ResourceGroupName <String>
-Name <String>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzMetricAlertRuleV2
-ResourceId <String>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
Get-AzMetricAlertRuleV2 Cmdlet 會依其名稱或 URI,或來自指定資源群組或訂用帳戶的所有計量警示規則,取得計量警示規則。
範例
範例 1:取得目前訂用帳戶中的所有計量警示規則
Get-AzMetricAlertRuleV2
TargetResourceId : /subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/metricResourceGroup/providers/Microsoft.KeyVault/vaults/GenevaRPKeyVault
Criteria : {Metric1}
Actions : {/subscriptions/00000000-0000-0000-0000-0000000/resourcegroups/sampleresourcegroup/providers/Microsoft.Insights/actiongroups/scnewactiongroup}
ResourceGroup : metricResourceGroup
Description : fdafda
Severity : 3
Enabled : True
Scopes : {/subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/metricResourceGroup/providers/Microsoft.KeyVault/vaults/GenevaRPKeyVault}
EvaluationFrequency : 00:01:00
WindowSize : 00:05:00
TargetResourceType :
TargetResourceRegion :
AutoMitigate :
LastUpdatedTime :
Id : /subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/metricResourceGroup/providers/Microsoft.Insights/metricAlerts/Rule1
Name : Rule1
Type : Microsoft.Insights/metricAlerts
Location : global
Tags : {}
Criteria : {Metric1}
Actions : {/subscriptions/00000000-0000-0000-0000-0000000/resourcegroups/sampleresourcegroup/providers/Microsoft.Insights/actiongroups/scnewactiongroup}
ResourceGroup : SampleResourceGroup
Description : Testing 1 minute granuarity
Severity : 3
Enabled : True
Scopes : {/subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/SampleResourceGroup/providers/Microsoft.Compute/virtualMachines/SCCMDemo4}
EvaluationFrequency : 00:01:00
WindowSize : 00:01:00
TargetResourceType : Microsoft.Compute/virtualMachines
TargetResourceRegion : eastus
AutoMitigate : True
LastUpdatedTime :
Id : /subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/SampleResourceGroup/providers/Microsoft.Insights/metricAlerts/Rule2
Name : Rule2
Type : Microsoft.Insights/metricAlerts
Location : global
Tags : {}
此命令會取得目前訂用帳戶中的所有計量警示規則。
範例 2:取得資源群組中的所有計量警示規則
Get-AzMetricAlertRuleV2 -ResourceGroupName metricAlertsRG
Criteria : {Metric1}
Actions : {/subscriptions/00000000-0000-0000-0000-0000000/resourcegroups/default-activitylogalerts/pr
oviders/Microsoft.Insights/actiongroups/emails}
ResourceGroup : metricAlertsRG
Description : Test Classic VM alert - CPU Usage
Severity : 3
Enabled : True
Scopes : {/subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/metricAlertsRG/providers/Micr
osoft.ClassicCompute/virtualMachines/VM1}
EvaluationFrequency : 00:01:00
WindowSize : 00:05:00
TargetResourceType : Microsoft.ClassicCompute/virtualMachines
TargetResourceRegion : southcentralus
AutoMitigate : True
LastUpdatedTime :
Id : /subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/metricAlertsRG/providers/micro
soft.insights/metricAlerts/Test%20Classic%20VM%20alert%20-%20CPU%20Usage
Name : Test Classic VM alert - CPU Usage
Type : Microsoft.Insights/metricAlerts
Location : global
Tags : {}
此命令會取得資源群組中名為 metricAlertsRG 的所有計量警示規則。
範例 3:依名稱取得計量警示規則
Get-AzMetricAlertRuleV2 -ResourceGroupName metricAlertsRG -Name PS3182019
Criteria : {metric1}
Actions : {/subscriptions/00000000-0000-0000-0000-0000000/resourcegroups/default-activitylogalerts/providers/Microsoft.Insights/actiongroups/demo}
ResourceGroup : metricAlertsRG
Description : This is description
Severity : 1
Enabled : True
Scopes : {/subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/metricAlertsRG/providers/Microsoft.Compute/virtualMachines/VM1,
/subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/metricAlertsRG/providers/Microsoft.Compute/virtualMachines/VM2}
EvaluationFrequency : 00:05:00
WindowSize : 00:05:00
TargetResourceType : Microsoft.Compute/virtualMachines
TargetResourceRegion : eastus
AutoMitigate :
LastUpdatedTime :
Id : /subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/metricAlertsRG/providers/Microsoft.Insights/metricAlerts/PS3182019
Name : PS3182019
Type : Microsoft.Insights/metricAlerts
Location : global
Tags :
此命令會取得名為 metricAlertsRG 的資源群組中名為 PS3182019的計量警示規則。
範例 4:依 ruleID 取得計量警示規則
Get-AzMetricAlertRuleV2 -ResourceId /subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/SampleResourceGroup/providers/Microsoft.Insights/metricAlerts/MyMetricAlertRule
TargetResourceId : /subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/SampleResourceGroup/providers/Microsoft.Insights/components/alertstestFunction
Criteria : {Metric1}
Actions : {/subscriptions/00000000-0000-0000-0000-0000000/resourcegroups/default-activitylogalerts/providers/Microsoft.Insights/actiongroups/emails}
ResourceGroup : SampleResourceGroup
Description : Test Description
Severity : 3
Enabled : True
Scopes : {/subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/SampleResourceGroup/providers/Microsoft.Insights/components/alertstestFunction}
EvaluationFrequency : 00:01:00
WindowSize : 00:05:00
TargetResourceType :
TargetResourceRegion :
AutoMitigate :
LastUpdatedTime :
Id : /subscriptions/00000000-0000-0000-0000-0000000/resourceGroups/SampleResourceGroup/providers/Microsoft.Insights/metricAlerts/MyMetricAlertRule
Name : MyMetricAlertRule
Type : Microsoft.Insights/metricAlerts
Location : global
Tags :
此命令會取得具有指定資源識別碼的計量警示規則。
參數
-DefaultProfile
用於與 Azure 通訊的認證、帳戶、租用戶和訂用帳戶。
類型: | IAzureContextContainer |
別名: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Name
計量警示規則的名稱
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-ResourceGroupName
The ResourceGroupName
類型: | String |
別名: | ResourceGroup |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-ResourceId
計量警示規則的規則標識碼
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |