az monitor metrics
View Azure resource metrics.
Commands
Name | Description | Type | Status |
---|---|---|---|
az monitor metrics alert |
Manage near-realtime metric alert rules. |
Core | GA |
az monitor metrics alert condition |
Manage near-realtime metric alert rule conditions. |
Core | GA |
az monitor metrics alert condition create |
Build a metric alert rule condition. |
Core | Preview |
az monitor metrics alert create |
Create a metric-based alert rule. |
Core | GA |
az monitor metrics alert delete |
Delete a metrics-based alert rule. |
Core | GA |
az monitor metrics alert dimension |
Manage near-realtime metric alert rule dimensions. |
Core | GA |
az monitor metrics alert dimension create |
Build a metric alert rule dimension. |
Core | Preview |
az monitor metrics alert list |
List metric-based alert rules. |
Core | GA |
az monitor metrics alert show |
Show a metrics-based alert rule. |
Core | GA |
az monitor metrics alert update |
Update a metric-based alert rule. |
Core | GA |
az monitor metrics list |
List the metric values for a resource. |
Core | GA |
az monitor metrics list-definitions |
List the metric definitions for the resource. |
Core | GA |
az monitor metrics list-namespaces |
List the metric namespaces for the resource. |
Core | Preview |
az monitor metrics list-sub |
Lists the metric data for a subscription. Parameters can be specified on the body. |
Core | GA |
az monitor metrics list-sub-definitions |
List the metric definitions for the subscription. |
Core | GA |
az monitor metrics list
List the metric values for a resource.
az monitor metrics list --resource
[--aggregation {Average, Count, Maximum, Minimum, None, Total}]
[--dimension]
[--end-time]
[--filter]
[--interval]
[--metadata]
[--metrics]
[--namespace]
[--offset]
[--orderby]
[--resource-group]
[--resource-namespace]
[--resource-parent]
[--resource-type]
[--start-time]
[--top]
Examples
List a VM's CPU usage for the past hour
az monitor metrics list --resource {ResourceName} --metric "Percentage CPU"
List success E2E latency of a storage account and split the data series based on API name
az monitor metrics list --resource {ResourceName} --metric SuccessE2ELatency \
--dimension ApiName
List success E2E latency of a storage account and split the data series based on both API name and geo type
az monitor metrics list --resource {ResourceName} --metric SuccessE2ELatency \
--dimension ApiName GeoType
List success E2E latency of a storage account and split the data series based on both API name and geo type using "--filter" parameter
az monitor metrics list --resource {ResourceName} --metric SuccessE2ELatency \
--filter "ApiName eq '*' and GeoType eq '*'"
List success E2E latency of a storage account and split the data series based on both API name and geo type. Limits the api name to 'DeleteContainer'
az monitor metrics list --resource {ResourceName} --metric SuccessE2ELatency \
--filter "ApiName eq 'DeleteContainer' and GeoType eq '*'"
List transactions of a storage account per day since 2017-01-01
az monitor metrics list --resource {ResourceName} --metric Transactions \
--start-time 2017-01-01T00:00:00Z \
--interval PT24H
List the metadata values for a storage account under transaction metric's api name dimension since 2017
az monitor metrics list --resource {ResourceName} --metric Transactions \
--filter "ApiName eq '*'" \
--start-time 2017-01-01T00:00:00Z
Required Parameters
Name or ID of the target resource.
Optional Parameters
The list of aggregation types (space-separated) to retrieve.
The list of dimensions (space-separated) the metrics are queried into.
End time of the query. Defaults to the current time. Format: date (yyyy-mm-dd) time (hh:mm:ss.xxxxx) timezone (+/-hh:mm).
A string used to reduce the set of metric data returned. eg. "BlobType eq '*'".
For a full list of filters, see the filter string reference at https://docs.microsoft.com/rest/api/monitor/metrics/list.
The interval over which to aggregate metrics, in ##h##m format.
Returns the metadata values instead of metric data.
Space-separated list of metric names to retrieve.
Namespace to query metric definitions for.
Time offset of the query range, in ##d##h format.
Can be used with either --start-time or --end-time. If used with --start-time, then the end time will be calculated by adding the offset. If used with --end-time (default), then the start time will be calculated by subtracting the offset. If --start-time and --end-time are provided, then --offset will be ignored.
Aggregation to use for sorting results and the direction of the sort. Only one order can be specificed. Examples: sum asc.
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').
Start time of the query. Format: date (yyyy-mm-dd) time (hh:mm:ss.xxxxx) timezone (+/-hh:mm).
Max number of records to retrieve.
Global Parameters
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 metrics list-definitions
List the metric definitions for the resource.
az monitor metrics list-definitions --resource
[--namespace]
[--resource-group]
[--resource-namespace]
[--resource-parent]
[--resource-type]
Examples
List the metric definitions for the resource. (autogenerated)
az monitor metrics list-definitions --resource /subscriptions/{subscriptionID}/resourceGroups/{resourceGroup}/Microsoft.Network/networkSecurityGroups/{resourceName}
Required Parameters
Name or ID of the target resource.
Optional Parameters
Namespace to query metric definitions for.
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').
Global Parameters
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 metrics list-namespaces
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
List the metric namespaces for the resource.
az monitor metrics list-namespaces --resource-uri
[--start-time]
Examples
List the metric namespaces for the resource.
az monitor metrics list-namespaces --resource /subscriptions/{subscriptionID}/resourceGroups/{resourceGroup}/Microsoft.Network/networkSecurityGroups/{resourceName} --start-time 2021-03-01T00:00:00Z
Required Parameters
The identifier of the resource.
Optional Parameters
Start time of the query. Format: date (yyyy-mm-dd) time (hh:mm:ss.xxxxx) timezone (+/-hh:mm).
Global Parameters
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 metrics list-sub
Lists the metric data for a subscription. Parameters can be specified on the body.
az monitor metrics list-sub --region
[--aggregation]
[--auto-adjust-timegrain {0, 1, f, false, n, no, t, true, y, yes}]
[--filter]
[--interval]
[--metricnames]
[--metricnamespace]
[--order-by]
[--result-type {Data, Metadata}]
[--roll-up-by]
[--timespan]
[--top]
[--validate-dimensions {0, 1, f, false, n, no, t, true, y, yes}]
Required Parameters
The region where the metrics you want reside.
Optional Parameters
The list of aggregation types (comma separated) to retrieve.
When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest supported timespan. When set to false, an error is returned for invalid timespan parameters. Defaults to false.
The $filter is used to reduce the set of metric data returned.
Example:
Metric contains metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’
- Invalid variant:
$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’
This is invalid because the logical or operator cannot separate two different metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’
- Return all time series where A = a1
$filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’.
The interval (i.e. timegrain) of the query in ISO 8601 duration format. Defaults to PT1M. Special case for 'FULL' value that returns single datapoint for entire time span requested. Examples: PT15M, PT1H, P1D, FULL.
The names of the metrics (comma separated) to retrieve.
Metric namespace where the metrics you want reside.
The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum asc.
Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details.
Dimension name(s) to rollup results by. For example if you only want to see metric values with a filter like 'City eq Seattle or City eq Tacoma' but don't want to see separate values for each city, you can specify 'RollUpBy=City' to see the results for Seattle and Tacoma rolled up into one timeseries.
The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10.
When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid filter parameters. Defaults to true.
Global Parameters
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 metrics list-sub-definitions
List the metric definitions for the subscription.
az monitor metrics list-sub-definitions --region
[--metricnamespace]
Required Parameters
The region where the metrics you want reside.
Optional Parameters
Metric namespace where the metrics you want reside.
Global Parameters
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.
Azure CLI