az monitor metrics

View Azure resource metrics.

Commands

az monitor metrics alert Manage near-realtime metric alert rules.
az monitor metrics alert create Create a metric-based alert rule.
az monitor metrics alert delete Delete a metrics-based alert rule.
az monitor metrics alert list List metric-based alert rules.
az monitor metrics alert show Show a metrics-based alert rule.
az monitor metrics alert update Update a metric-based alert rule.
az monitor metrics list List the metric values for a resource.
az monitor metrics list-definitions Lists the metric definitions for the resource.

az monitor metrics list

List the metric values for a resource.

az monitor metrics list --resource
[--aggregation {Average, Count, Maximum, Minimum, Total}]
[--dimension]
[--end-time]
[--filter]
[--interval]
[--metadata]
[--metrics]
[--namespace]
[--offset]
[--orderby]
[--resource-group]
[--resource-namespace]
[--resource-parent]
[--resource-type]
[--start-time]
[--subscription]
[--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

--resource

Name or ID of the target resource.

Optional Parameters

--aggregation

The list of aggregation types (space-separated) to retrieve.

accepted values: Average, Count, Maximum, Minimum, Total
value from: az monitor metrics list-definitions
--dimension

The list of dimensions (space-separated) the metrics are queried into.

value from: az monitor metrics list-definitions
--end-time

End time of the query. Defaults to the current time. Format: date (yyyy-mm-dd) time (hh:mm:ss.xxxxx) timezone (+/-hh:mm).

--filter

A string used to reduce the set of metric data returned. eg. "BlobType eq '*'".

--interval

The interval over which to aggregate metrics, in ##h##m format.

default value: 1m
--metadata

Returns the metadata values instead of metric data.

--metrics

Space-separated list of metric names to retrieve.

value from: az monitor metrics list-definitions
--namespace

Namespace to query metric definitions for.

value from: az monitor metrics list-definitions
--offset

Time offset of the query range, in ##d##h format.

default value: 1h
--orderby

Aggregation to use for sorting results and the direction of the sort. Only one order can be specificed. Examples: sum asc.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--resource-namespace

Target resource provider namespace.

--resource-parent

Target resource parent path, if applicable.

--resource-type

Target resource type. Can also accept namespace/type format (Ex: 'Microsoft.Compute/virtualMachines').

--start-time

Start time of the query. Format: date (yyyy-mm-dd) time (hh:mm:ss.xxxxx) timezone (+/-hh:mm).

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--top

Max number of records to retrieve. Valid only if --filter used.

default value: 10

az monitor metrics list-definitions

Lists the metric definitions for the resource.

az monitor metrics list-definitions --resource
[--namespace]
[--resource-group]
[--resource-namespace]
[--resource-parent]
[--resource-type]
[--subscription]

Examples

Lists the metric definitions for the resource. (autogenerated)

az monitor metrics list-definitions --resource /subscriptions/{subscriptionID}/resourceGroups/Space1999/providers/Microsoft.Network/networkSecurityGroups/ADDS-NSG

Required Parameters

--resource

Name or ID of the target resource.

Optional Parameters

--namespace

Namespace to query metric definitions for.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--resource-namespace

Target resource provider namespace.

--resource-parent

Target resource parent path, if applicable.

--resource-type

Target resource type. Can also accept namespace/type format (Ex: 'Microsoft.Compute/virtualMachines').

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.