az vm monitor metrics

Manage metrics for a vm.

Commands

az vm monitor metrics list-definitions

List the metric definitions for a VM.

az vm monitor metrics tail

List the metric values for a VM.

az vm monitor metrics list-definitions

List the metric definitions for a VM.

az vm monitor metrics list-definitions --name
                                       --resource-group
                                       [--namespace]
                                       [--subscription]

Examples

List the metric definitions for a VM. (autogenerated)

az vm monitor metrics list-definitions --name MyIDVirtualMachine --resource-group MyResourceGroup --subscription MySubscription

Required Parameters

--name -n

Name or ID of a virtual machine.

--resource-group -g

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

Optional Parameters

--namespace

Namespace to query metric definitions for.

--subscription

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

az vm monitor metrics tail

List the metric values for a VM.

az vm monitor metrics tail --name
                           --resource-group
                           [--aggregation {Average, Count, Maximum, Minimum, Total}]
                           [--dimension]
                           [--end-time]
                           [--filter]
                           [--interval]
                           [--metadata]
                           [--metrics]
                           [--namespace]
                           [--offset]
                           [--orderby]
                           [--start-time]
                           [--subscription]
                           [--top]

Examples

List CPU usage of VM for past one hour

az vm monitor metrics tail --name myVM -g myRG --metric "Percentage CPU"

List one hour CPU usage of VM started at 2019-12-18T00:00:00Z

az vm monitor metrics tail --name myVM -g myRG --metric "Percentage CPU" --start-time 2019-12-18T00:00:00Z

List CPU usage of VM for past one hour with filter

az vm monitor metrics tail --name myVM -g myRG --metrics "Per Disk Read Bytes/sec" --filter "SlotId eq '*'"

Required Parameters

--name -n

Name or ID of a virtual machine.

--resource-group -g

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

Optional Parameters

--aggregation

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

accepted values: Average, Count, Maximum, Minimum, Total
value from: az vm monitor metrics list-definitions -n MyVM -g MyRG --query "@[*].supportedAggregationTypes"
--dimension

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

value from: az vm monitor metrics list-definitions -n MyVM -g MyRG --query "@[*].dimensions"
--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. "LUN eq '*'".

--interval

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

default value: 1m
--metadata

Return the metadata values instead of metric data.

--metrics

Space-separated list of metric names to retrieve.

value from: az vm monitor metrics list-definitions -n MyVM -g MyRG --query "@[*].name.value"
--namespace

Namespace to query metric definitions for.

--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.

--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