Share via


az vm monitor metrics

This command group is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Manage metrics for a vm.

Commands

Name Description Type Status
az vm monitor metrics list-definitions

List the metric definitions for a VM.

Core Preview
az vm monitor metrics tail

List the metric values for a VM.

Core Preview

az vm monitor metrics list-definitions

Preview

Command group 'vm monitor metrics' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

List the metric definitions for a VM.

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

Examples

List the metric definitions for a VM. (autogenerated)

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

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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az vm monitor metrics tail

Preview

Command group 'vm monitor metrics' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

List the metric values for a VM.

az vm monitor metrics tail --name
                           --resource-group
                           [--aggregation {Average, Count, Maximum, Minimum, None, Total}]
                           [--dimension]
                           [--end-time]
                           [--filter]
                           [--interval]
                           [--metadata]
                           [--metrics]
                           [--namespace]
                           [--offset]
                           [--orderby]
                           [--start-time]
                           [--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, None, 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 '*'".

For a full list of filters, see the filter string reference at https://docs.microsoft.com/rest/api/monitor/metrics/list.

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

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.

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

--top

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

Default value: 10
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.