azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Get-AzMetric only returns Average but no value for Maximum, Minimum

Open william-li-nintex opened this issue 4 years ago • 7 comments

Description

When using Get-AzMetric following the documentation here, it only returns Average but never for Minimum and Maximum values as below screenshot. Just curious to know how to get Minimum and Maximum values as we can see in the Azure Portal.

image

My Command is as follows, the resource id is any resource id for an Azure SQL Database

(Get-AzMetric -ResourceId "someAzureSqlDbResourceIdxxxxxxxxxx" -MetricName "dtu_consumption_percent" -TimeGrain "00:01:00" -StartTime "2022-03-12T05:40:40Z").Data

Script or Debug output

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}       
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

No response

Error output

There is no error

william-li-nintex avatar Mar 13 '22 09:03 william-li-nintex

@VeryEarly , please help look into it.

dingmeng-xue avatar Mar 14 '22 23:03 dingmeng-xue

May I ask if there's an update on this please? Thanks

william-li-nintex avatar Mar 30 '22 09:03 william-li-nintex

@william-li-nintex , metric returns the result according to resource type and metric. You can search dtu_consumption_percent on page https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported#microsoftsqlserversdatabases. The aggregation type is "average". The return result is by design.

dingmeng-xue avatar Mar 30 '22 13:03 dingmeng-xue

@dingmeng-xue Thanks for your reply. The reason I raised this is because the max/min data is available in the app insights metrics per below screenshot, just wondering is there a way to retrieve the data, either using PowerShell or Api. Thanks. image

william-li-nintex avatar Mar 30 '22 20:03 william-li-nintex

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzMonEssential.

Issue Details

Description

When using Get-AzMetric following the documentation here, it only returns Average but never for Minimum and Maximum values as below screenshot. Just curious to know how to get Minimum and Maximum values as we can see in the Azure Portal.

image

My Command is as follows, the resource id is any resource id for an Azure SQL Database

(Get-AzMetric -ResourceId "someAzureSqlDbResourceIdxxxxxxxxxx" -MetricName "dtu_consumption_percent" -TimeGrain "00:01:00" -StartTime "2022-03-12T05:40:40Z").Data

Script or Debug output

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}       
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

No response

Error output

There is no error
Author: william-li-nintex
Assignees: VeryEarly
Labels:

Service Attention, question, Monitor - Metrics, customer-reported

Milestone: -

ghost avatar Mar 31 '22 13:03 ghost

hello.. wondering if this has been answered already? :)

maeganda11 avatar Nov 17 '22 09:11 maeganda11

May be I am late to the party but I got the same issue and seems we have new input parameter called -AggregationType which can be used to get the maximum value of metrics.

image

amjad30nagori avatar May 24 '23 12:05 amjad30nagori