Share via


az monitor app-insights metrics

Note

This reference is part of the application-insights extension for the Azure CLI (version 2.55.0 or higher). The extension will automatically install the first time you run an az monitor app-insights metrics command. Learn more about extensions.

Retrieve metrics from an application.

Commands

Name Description Type Status
az monitor app-insights metrics get-metadata

Get the metadata for metrics on a particular application.

Extension GA
az monitor app-insights metrics show

View the value of a single metric.

Extension GA

az monitor app-insights metrics get-metadata

Get the metadata for metrics on a particular application.

az monitor app-insights metrics get-metadata [--app]
                                             [--ids]
                                             [--resource-group]
                                             [--subscription]

Examples

Views the metadata for the provided app.

az monitor app-insights metrics get-metadata --app e292531c-eb03-4079-9bb0-fe6b56b99f8b

Optional Parameters

--app -a

GUID, app name, or fully-qualified Azure resource name of Application Insights component. The application GUID may be acquired from the API Access menu item on any Application Insights resource in the Azure portal. If using an application name, please specify resource group.

--ids

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.

--resource-group -g

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

--subscription

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

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 monitor app-insights metrics show

View the value of a single metric.

az monitor app-insights metrics show --metrics
                                     [--aggregation]
                                     [--app]
                                     [--end-time]
                                     [--filter]
                                     [--ids]
                                     [--interval]
                                     [--offset]
                                     [--orderby]
                                     [--resource-group]
                                     [--segment]
                                     [--start-time]
                                     [--subscription]
                                     [--top]

Examples

View the count of availabilityResults events.

az monitor app-insights metrics show --app e292531c-eb03-4079-9bb0-fe6b56b99f8b --metric availabilityResults/count

Required Parameters

--metrics -m

The metric to retrieve. May be either a standard AI metric or an application-specific custom metric.

Optional Parameters

--aggregation

The aggregation to use when computing the metric values. To retrieve more than one aggregation at a time, separate them with a comma. If no aggregation is specified, then the default aggregation for the metric is used.

--app -a

GUID, app name, or fully-qualified Azure resource name of Application Insights component. The application GUID may be acquired from the API Access menu item on any Application Insights resource in the Azure portal. If using an application name, please specify resource group.

--end-time

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

--filter

An expression used to filter the results. This value should be a valid OData filter expression where the keys of each clause should be applicable dimensions for the metric you are retrieving.

--ids

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.

--interval

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

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

The aggregation function and direction to sort the segments by. This value is only valid when segment is specified.

--resource-group -g

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

--segment

The name of the dimension to segment the metric values by. This dimension must be applicable to the metric you are retrieving. To segment by more than one dimension at a time, separate them with a comma (,). In this case, the metric data will be segmented in the order the dimensions are listed in the parameter.

--start-time

Start-time of time range for which to retrieve data. 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

The number of segments to return. This value is only valid when segment is specified.

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.