Gets the metric values of a resource.
Syntax GetWithDefaultParameters (Default)Get-AzMetric
[-ResourceId] <String>
[[-MetricName] <String[]>]
[-TimeGrain <TimeSpan>]
[-StartTime <DateTime>]
[-EndTime <DateTime>]
[-MetricFilter <String>]
[-Dimension <String[]>]
[-DetailedOutput]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
GetWithFullParameters
Get-AzMetric
[-ResourceId] <String>
[-MetricName] <String[]>
[-TimeGrain <TimeSpan>]
[-AggregationType <AggregationType>]
[-StartTime <DateTime>]
[-EndTime <DateTime>]
[-Top <Int32>]
[-OrderBy <String>]
[-MetricNamespace <String>]
[-ResultType <ResultType>]
[-MetricFilter <String>]
[-Dimension <String[]>]
[-DetailedOutput]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Get-AzMetric cmdlet gets the metric values for a specified resource.
Examples Example 1: Get a metric with summarized outputGet-AzMetric -ResourceId "/subscriptions/e3f5b07d-3c39-4b0f-bf3b-40fdeba10f2a/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website3" -TimeGrain 00:01:00
Id : /subscriptions/e3f5b07d-3c39-4b0f-bf3b-40fdeba10f2a/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website3/providers/Microsoft.Insights/metrics/Requests
Name :
LocalizedValue : Requests
Value : Requests
Type : Microsoft.Insights/metrics
Unit : Count
Data : {Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricValue, Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricValue,
Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricValue, Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricValueâ¦}
Timeseries : {Microsoft.Azure.Management.Monitor.Models.TimeSeriesElement}
This command gets the metric values for website3 with a time grain of 1 minute.
Example 2: Get a metric with detailed outputGet-AzMetric -ResourceId "/subscriptions/e3f5b07d-3c39-4b0f-bf3b-40fdeba10f2a/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website3" -TimeGrain 00:01:00 -DetailedOutput
Id : /subscriptions/e3f5b07d-3c39-4b0f-bf3b-40fdeba10f2a/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website3/providers/Microsoft.Insights/metrics/Requests
Name : Microsoft.Azure.Management.Monitor.Models.LocalizableString
Type : Microsoft.Insights/metrics
Unit : Count
Data : {Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricValue, Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricValue,
Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricValue, Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricValueâ¦}
Timeseries : {Microsoft.Azure.Management.Monitor.Models.TimeSeriesElement}
This command gets the metric values for website3 with a time grain of 1 minute. The output is detailed.
Example 3: Get a specified metricGet-AzMetric -ResourceId "/subscriptions/e3f5b07d-3c39-4b0f-bf3b-40fdeba10f2a/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website3" -MetricName "Requests" -TimeGrain 00:01:00
Id : /subscriptions/e3f5b07d-3c39-4b0f-bf3b-40fdeba10f2a/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/website3/providers/Microsoft.Insights/metrics/Requests
Name :
LocalizedValue : Requests
Value : Requests
Type : Microsoft.Insights/metrics
Unit : Count
Data : {Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricValue, Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricValue,
Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricValue, Microsoft.Azure.Commands.Insights.OutputClasses.PSMetricValueâ¦}
Timeseries : {Microsoft.Azure.Management.Monitor.Models.TimeSeriesElement}
This command gets detailed output for the Requests metric.
Example 4: Get summarized output for a specified metric with specified dimension filter$dimFilter = "$(New-AzMetricFilter -Dimension City -Operator eq -Value "Seattle","Toronto") and $(New-AzMetricFilter -Dimension AuthenticationType -Operator eq -Value User)"
Get-AzMetric -ResourceId <ResourceId> -MetricName availabilityResults/availabilityPercentage -TimeGrain 00:05:00 -MetricFilter $dimFilter -StartTime 2024-07-02T00:00:00Z -EndTime 2024-07-02T00:10:00Z -AggregationType Average
Id : [ResourceId]/providers/Microsoft.Insights/metrics/availabilityResults/availabilityPercentage
Name :
LocalizedValue : Availability
Value : availabilityResults/availabilityPercentage
Type : Microsoft.Insights/metrics
Unit : Percent
Data :
Timeseries : {}
This command gets summarized output for the PageViews metric with specified dimension filter and aggregation type.
Parameters -AggregationTypeThe aggregation type of the query
Parameter properties Type:Nullable<T>[Microsoft.Azure.Management.Monitor.Models.AggregationType]
Default value: None Accepted values: None, Average, Count, Minimum, Maximum, Total Supports wildcards: False DontShow: False Parameter sets GetWithFullParameters Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -DefaultProfileThe credentials, account, tenant, and subscription used for communication with azure.
Parameter properties Type: IAzureContextContainer Default value: None Supports wildcards: False DontShow: False Aliases: AzContext, AzureRmContext, AzureCredential Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -DetailedOutputIndicates that this cmdlet displays detailed output. By default, output is summarized.
Parameter properties Type: SwitchParameter Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -DimensionThe metric dimensions to query metrics for
Parameter properties Type:String[]
Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -EndTimeSpecifies the end time of the query in local time. The default is the current time.
Parameter properties Type: DateTime Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -MetricFilterSpecifies the metric dimension filter to query metrics for.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -MetricNameSpecifies an array of names of metrics.
Parameter properties Type:String[]
Default value: None Supports wildcards: False DontShow: False Aliases: MetricNames Parameter sets GetWithDefaultParameters Position: 1 Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -MetricNamespaceSpecifies the metric namespace to query metrics for.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets GetWithFullParameters Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -OrderBySpecifies the aggregation to use for sorting results and the direction of the sort (Example: sum asc).
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets GetWithFullParameters Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -ResourceIdSpecifies the resource ID of the metric.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: 0 Mandatory: True Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -ResultTypeSpecifies the result type to be returned (metadata or data).
Parameter properties Type:Nullable<T>[Microsoft.Azure.Management.Monitor.Models.ResultType]
Default value: None Accepted values: Data, Metadata Supports wildcards: False DontShow: False Parameter sets GetWithFullParameters Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -StartTimeSpecifies the start time of the query in local time. The default is the current local time minus one hour.
Parameter properties Type: DateTime Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -TimeGrainSpecifies the time grain of the metric as a TimeSpan object in the format hh:mm:ss.
Parameter properties Type: TimeSpan Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -TopSpecifies the maximum number of records to retrieve (default:10), to be specified with $filter.
Parameter properties Type: Default value: None Supports wildcards: False DontShow: False Parameter sets GetWithFullParameters Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False CommonParametersThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs String TimeSpan Nullable<T> DateTime Nullable<T> Nullable<T> String SwitchParameter Outputs PSMetric NotesMore information about the supported metrics may be found at: https://learn.microsoft.com/azure/azure-monitor/platform/metrics-supported
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4