Skip to content

Commit d2d0e87

Browse files
authored
Merge pull request #234659 from EdB-MSFT/autoscale-common-metrics
Autoscale common metrics
2 parents 4bb951c + 28f1d25 commit d2d0e87

File tree

1 file changed

+24
-34
lines changed

1 file changed

+24
-34
lines changed

articles/azure-monitor/autoscale/autoscale-common-metrics.md

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,49 @@ description: Learn which metrics are commonly used for autoscaling your cloud se
44
author: EdB-MSFT
55
ms.author: edbaynash
66
ms.topic: conceptual
7-
ms.date: 04/22/2022
7+
ms.date: 04/17/2023
88
ms.subservice: autoscale
99
ms.reviewer: akkumari
1010
---
1111

1212
# Azure Monitor autoscaling common metrics
1313

14-
[!INCLUDE [updated-for-az](../../../includes/updated-for-az.md)]
14+
Azure Monitor autoscaling allows you to scale the number of running instances in or out, based on telemetry data or metrics. Scaling can be based on any metric, even metrics from a different resource. For example, scale a Virtual Machine Scale Set based on the amount of traffic on a firewall.
1515

16-
Azure Monitor autoscaling allows you to scale the number of running instances up or down, based on telemetry data, also known as metrics. This article describes common metrics that you might want to use. In the Azure portal, you can choose the metric of the resource to scale by. You can also choose any metric from a different resource to scale by.
16+
This article describes metrics that are commonly used to trigger scale events.
1717

18-
Azure Monitor autoscale applies only to [Azure Virtual Machine Scale Sets](https://azure.microsoft.com/services/virtual-machine-scale-sets/), [Azure Cloud Services](https://azure.microsoft.com/services/cloud-services/), [Azure App Service - Web Apps](https://azure.microsoft.com/services/app-service/web/), and [Azure API Management](../../api-management/api-management-key-concepts.md). Other Azure services use different scaling methods.
18+
Azure autoscale supports many resource types. For more information about supported resources, see [autoscale supported resources](./autoscale-overview.md#supported-services-for-autoscale).
1919

20-
## Compute metrics for Resource Manager-based VMs
20+
For all resources, you can get a list of the available metrics using the PowerShell or Azure CLI
2121

22-
By default, Azure Resource Manager-based virtual machines and virtual machine scale sets emit basic (host-level) metrics. In addition, when you configure diagnostics data collection for an Azure VM and virtual machine scale sets, the Azure Diagnostics extension also emits guest-OS performance counters. These counters are commonly known as "guest-OS metrics." You use all these metrics in autoscale rules.
22+
```azurepowershell
23+
Get-AzMetricDefinition -ResourceId <resource_id>
24+
```
2325

24-
You can use the `Get MetricDefinitions` API/PoSH/CLI to view the metrics available for your Virtual Machine Scale Sets resource.
26+
```azurecli
27+
az monitor metrics list-definitions --resource <resource_id>
28+
```
29+
30+
## Compute metrics for Resource Manager-based VMs
2531

26-
If you're using virtual machine scale sets and you don't see a particular metric listed, it's likely *disabled* in your Diagnostics extension.
32+
By default, Azure Resource Manager-based virtual machines and Virtual Machine Scale Sets emit basic (host-level) metrics. In addition, when you configure diagnostics data collection for an Azure VM and Virtual Machine Scale Sets, the Azure Diagnostics extension also emits guest-OS performance counters. These counters are commonly known as "guest-OS metrics." You use all these metrics in autoscale rules.
33+
34+
If you're using Virtual Machine Scale Sets and you don't see a particular metric listed, it's likely *disabled* in your Diagnostics extension.
2735

2836
If a particular metric isn't being sampled or transferred at the frequency you want, you can update the diagnostics configuration.
2937

3038
If either preceding case is true, see [Use PowerShell to enable Azure Diagnostics in a virtual machine running Windows](../../virtual-machines/extensions/diagnostics-windows.md) to configure and update your Azure VM Diagnostics extension to enable the metric. The article also includes a sample diagnostics configuration file.
3139

3240
### Host metrics for Resource Manager-based Windows and Linux VMs
3341

34-
The following host-level metrics are emitted by default for Azure VM and virtual machine scale sets in both Windows and Linux instances. These metrics describe your Azure VM but are collected from the Azure VM host rather than via agent installed on the guest VM. You can use these metrics in autoscaling rules.
42+
The following host-level metrics are emitted by default for Azure VM and Virtual Machine Scale Sets in both Windows and Linux instances. These metrics describe your Azure VM but are collected from the Azure VM host rather than via agent installed on the guest VM. You can use these metrics in autoscaling rules.
3543

3644
- [Host metrics for Resource Manager-based Windows and Linux VMs](../essentials/metrics-supported.md#microsoftcomputevirtualmachines)
37-
- [Host metrics for Resource Manager-based Windows and Linux virtual machine scale sets](../essentials/metrics-supported.md#microsoftcomputevirtualmachinescalesets)
45+
- [Host metrics for Resource Manager-based Windows and Linux Virtual Machine Scale Sets](../essentials/metrics-supported.md#microsoftcomputevirtualmachinescalesets)
3846

3947
### Guest OS metrics for Resource Manager-based Windows VMs
4048

41-
When you create a VM in Azure, diagnostics is enabled by using the Diagnostics extension. The Diagnostics extension emits a set of metrics taken from inside of the VM. This means you can autoscale off of metrics that aren't emitted by default.
42-
43-
You can generate a list of the metrics by using the following command in PowerShell.
44-
45-
```
46-
Get-AzMetricDefinition -ResourceId <resource_id> | Format-Table -Property Name,Unit
47-
```
49+
When you create a VM in Azure, diagnostics is enabled by using the Diagnostics extension. The Diagnostics extension emits a set of metrics taken from inside of the VM. This means you can autoscale using metrics that aren't emitted by default.
4850

4951
You can create an alert for the following metrics:
5052

@@ -82,12 +84,6 @@ You can create an alert for the following metrics:
8284

8385
When you create a VM in Azure, diagnostics is enabled by default by using the Diagnostics extension.
8486

85-
You can generate a list of the metrics by using the following command in PowerShell.
86-
87-
```
88-
Get-AzMetricDefinition -ResourceId <resource_id> | Format-Table -Property Name,Unit
89-
```
90-
9187
You can create an alert for the following metrics:
9288

9389
| Metric name | Unit |
@@ -137,13 +133,7 @@ You can also perform autoscale based on common web server metrics such as the HT
137133

138134
### Web Apps metrics
139135

140-
You can generate a list of the Web Apps metrics by using the following command in PowerShell:
141-
142-
```
143-
Get-AzMetricDefinition -ResourceId <resource_id> | Format-Table -Property Name,Unit
144-
```
145-
146-
You can alert on or scale by these metrics.
136+
for Web Apps, you can alert on or scale by these metrics.
147137

148138
| Metric name | Unit |
149139
| --- | --- |
@@ -158,7 +148,7 @@ You can alert on or scale by these metrics.
158148

159149
You can scale by Azure Storage queue length, which is the number of messages in the Storage queue. Storage queue length is a special metric, and the threshold is the number of messages per instance. For example, if there are two instances and if the threshold is set to 100, scaling occurs when the total number of messages in the queue is 200. That amount can be 100 messages per instance, 120 plus 80, or any other combination that adds up to 200 or more.
160150

161-
Configure this setting in the Azure portal in the **Settings** pane. For virtual machine scale sets, you can update the autoscale setting in the Resource Manager template to use `metricName` as `ApproximateMessageCount` and pass the ID of the storage queue as `metricResourceUri`.
151+
Configure this setting in the Azure portal in the **Settings** pane. For Virtual Machine Scale Sets, you can update the autoscale setting in the Resource Manager template to use `metricName` as `ApproximateMessageCount` and pass the ID of the storage queue as `metricResourceUri`.
162152

163153
For example, with a Classic Storage account, the autoscale setting `metricTrigger` would include:
164154

@@ -178,9 +168,9 @@ For a (non-classic) Storage account, the `metricTrigger` setting would include:
178168

179169
## Commonly used Service Bus metrics
180170

181-
You can scale by Azure Service Bus queue length, which is the number of messages in the Service Bus queue. Service Bus queue length is a special metric, and the threshold is the number of messages per instance. For example, if there are two instances and if the threshold is set to 100, scaling occurs when the total number of messages in the queue is 200. That amount can be 100 messages per instance, 120 plus 80, or any other combination that adds up to 200 or more.
171+
You can scale by Azure Service Bus queue length, which is the number of messages in the Service Bus queue. Service Bus queue length is a special metric, and the threshold is the number of messages per instance. For example, if there are two instances, and if the threshold is set to 100, scaling occurs when the total number of messages in the queue is 200. That amount can be 100 messages per instance, 120 plus 80, or any other combination that adds up to 200 or more.
182172

183-
For virtual machine scale sets, you can update the autoscale setting in the Resource Manager template to use `metricName` as `ApproximateMessageCount` and pass the ID of the storage queue as `metricResourceUri`.
173+
For Virtual Machine Scale Sets, you can update the autoscale setting in the Resource Manager template to use `metricName` as `ApproximateMessageCount` and pass the ID of the storage queue as `metricResourceUri`.
184174

185175
```
186176
"metricName": "ApproximateMessageCount",
@@ -189,4 +179,4 @@ For virtual machine scale sets, you can update the autoscale setting in the Reso
189179
```
190180

191181
> [!NOTE]
192-
> For Service Bus, the resource group concept doesn't exist, but Azure Resource Manager creates a default resource group per region. The resource group is usually in the Default-ServiceBus-[region] format. Examples are Default-ServiceBus-EastUS, Default-ServiceBus-WestUS, and Default-ServiceBus-AustraliaEast.
182+
> For Service Bus, the resource group concept doesn't exist. Azure Resource Manager creates a default resource group per region. The resource group is usually in the Default-ServiceBus-[region] format. Examples are Default-ServiceBus-EastUS, Default-ServiceBus-WestUS, and Default-ServiceBus-AustraliaEast.

0 commit comments

Comments
 (0)