az monitor alert
Manage classic metric-based alert rules.
Commands
| az monitor alert create |
Create a classic metric-based alert rule. |
| az monitor alert delete |
Delete an alert rule. |
| az monitor alert list |
List alert rules in a resource group. |
| az monitor alert list-incidents |
List all incidents for an alert rule. |
| az monitor alert show |
Show an alert rule. |
| az monitor alert show-incident |
Get the details of an alert rule incident. |
| az monitor alert update |
Update a classic metric-based alert rule. |
az monitor alert create
Create a classic metric-based alert rule.
az monitor alert create --condition
--name
--target
[--action]
[--description]
[--disabled {false, true}]
[--email-service-owners {false, true}]
[--location]
[--resource-group]
[--tags]
[--target-namespace]
[--target-parent]
[--target-type]
Examples
Create a high CPU usage alert on a VM with no actions.
az monitor alert create -n rule1 -g {ResourceGroup} --target {VirtualMachineID} --condition "Percentage CPU > 90 avg 5m"
Create a high CPU usage alert on a VM with email and webhook actions.
az monitor alert create -n rule1 -g {ResourceGroup} --target {VirtualMachineID} \
--condition "Percentage CPU > 90 avg 5m" \
--action email bob@contoso.comann@contoso.com --email-service-owners \
--action webhook https://www.contoso.com/alerts?type=HighCPU \
--action webhook https://alerts.contoso.com apiKey={APIKey} type=HighCPU
Required Parameters
The condition which triggers the rule.
Name of the alert rule.
Name or ID of the target resource.
Optional Parameters
Add an action to fire when the alert is triggered.
Free-text description of the rule. Defaults to the condition expression.
Create the rule in a disabled state.
Email the service owners if an alert is triggered.
Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Target resource provider namespace.
Target resource parent path, if applicable.
Target resource type. Can also accept namespace/type format (Ex: 'Microsoft.Compute/virtualMachines').
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az monitor alert delete
Delete an alert rule.
az monitor alert delete [--ids]
[--name]
[--resource-group]
Examples
Delete an alert rule. (autogenerated)
az monitor alert delete --name MyAlertRule --resource-group MyResourceGroup
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Name of the alert rule.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az monitor alert list
List alert rules in a resource group.
az monitor alert list --resource-group
Examples
List alert rules in a resource group. (autogenerated)
az monitor alert list --resource-group MyResourceGroup
Required Parameters
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az monitor alert list-incidents
List all incidents for an alert rule.
az monitor alert list-incidents --resource-group
--rule-name
Examples
List all incidents for an alert rule. (autogenerated)
az monitor alert list-incidents --resource-group MyResourceGroup --rule-name MyRule
Required Parameters
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Name of the alert rule.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az monitor alert show
Show an alert rule.
az monitor alert show [--ids]
[--name]
[--resource-group]
Examples
Show an alert rule. (autogenerated)
az monitor alert show --name MyAlertRule --resource-group MyResourceGroup
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Name of the alert rule.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az monitor alert show-incident
Get the details of an alert rule incident.
az monitor alert show-incident [--ids]
[--name]
[--resource-group]
[--rule-name]
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the incident to retrieve.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Name of the alert rule.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az monitor alert update
Update a classic metric-based alert rule.
az monitor alert update [--add]
[--add-action]
[--aggregation {avg, last, max, min, total}]
[--condition]
[--description]
[--email-service-owners {false, true}]
[--enabled]
[--force-string]
[--ids]
[--metric]
[--name]
[--operator {<, <=, >, >=}]
[--period]
[--remove]
[--remove-action]
[--resource]
[--resource-group]
[--resource-namespace]
[--resource-parent]
[--resource-type]
[--set]
[--tags]
[--threshold]
Examples
Update a classic metric-based alert rule. (autogenerated)
az monitor alert update --email-service-owners true --name MyAlertRule --resource-group MyResourceGroup
Update a classic metric-based alert rule. (autogenerated)
az monitor alert update --name MyAlertRule --remove-action email bob@contoso.com --resource-group MyResourceGroup
Update a classic metric-based alert rule. (autogenerated)
az monitor alert update --name MyAlertRule --resource-group MyResourceGroup --set retentionPolicy.days=365
Optional Parameters
Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.
Add an action to fire when the alert is triggered.
Type of aggregation to apply based on --period.
The condition which triggers the rule.
Description of the rule.
Email the service owners if an alert is triggered.
When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Name of the metric to base the rule on.
Name of the alert rule.
How to compare the metric against the threshold.
Time span over which to apply --aggregation, in nDnHnMnS shorthand or full ISO8601 format.
Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.
Remove one or more actions.
Name or ID of the target resource.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Target resource provider namespace.
Target resource parent path, if applicable.
Target resource type. Can also accept namespace/type format (Ex: 'Microsoft.Compute/virtualMachines').
Update an object by specifying a property path and value to set. Example: --set property1.property2=.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Numeric threshold at which to trigger the alert.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
الملاحظات
إرسال الملاحظات وعرضها المتعلقة بـ