Use Azure autoscale with guest metrics in a Linux scale set template - Azure Virtual Machine Scale Sets (2024)

  • Article

There are two broad types of metrics in Azure that are gathered from VMs and scale sets: Host metrics and Guest metrics. At a high level, if you would like to use standard CPU, disk, and network metrics, then host metrics are a good fit. If, however, you need a larger selection of metrics, then guest metrics should be looked into.

Host metrics do not require additional setup because they are collected by the host VM, whereas guest metrics require you to install the Windows Azure Diagnostics extension or the Linux Azure Diagnostics extension in the guest VM. One common reason to use guest metrics instead of host metrics is that guest metrics provide a larger selection of metrics than host metrics. One such example is memory-consumption metrics, which are only available via guest metrics. The supported host metrics are listed here, and commonly used guest metrics are listed here. This article shows how to modify the basic viable scale set template to use autoscale rules based on guest metrics for Linux scale sets.

Change the template definition

In a previous article we had created a basic scale set template. We will now use that earlier template and modify it to create a template that deploys a Linux scale set with guest metric based autoscale.

First, add parameters for storageAccountName and storageAccountSasToken. The diagnostics agent stores metric data in a table in this storage account. As of the Linux Diagnostics Agent version 3.0, using a storage access key is no longer supported. Instead, use a SAS Token.

 }, "adminPassword": { "type": "securestring"+ },+ "storageAccountName": {+ "type": "string"+ },+ "storageAccountSasToken": {+ "type": "securestring" } },

Next, modify the scale set extensionProfile to include the diagnostics extension. In this configuration, specify the resource ID of the scale set to collect metrics from, as well as the storage account and SAS token to use to store the metrics. Specify how frequently the metrics are aggregated (in this case, every minute) and which metrics to track (in this case, percent used memory). For more detailed information on this configuration and metrics other than percent used memory, see this documentation.

 } } ]+ },+ "extensionProfile": {+ "extensions": [+ {+ "name": "LinuxDiagnosticExtension",+ "properties": {+ "publisher": "Microsoft.Azure.Diagnostics",+ "type": "LinuxDiagnostic",+ "typeHandlerVersion": "3.0",+ "settings": {+ "StorageAccount": "[parameters('storageAccountName')]",+ "ladCfg": {+ "diagnosticMonitorConfiguration": {+ "performanceCounters": {+ "sinks": "WADMetricJsonBlob",+ "performanceCounterConfiguration": [+ {+ "unit": "percent",+ "type": "builtin",+ "class": "memory",+ "counter": "percentUsedMemory",+ "counterSpecifier": "/builtin/memory/percentUsedMemory",+ "condition": "IsAggregate=TRUE"+ }+ ]+ },+ "metrics": {+ "metricAggregation": [+ {+ "scheduledTransferPeriod": "PT1M"+ }+ ],+ "resourceId": "[resourceId('Microsoft.Compute/virtualMachineScaleSets', 'myScaleSet')]"+ }+ }+ }+ },+ "protectedSettings": {+ "storageAccountName": "[parameters('storageAccountName')]",+ "storageAccountSasToken": "[parameters('storageAccountSasToken')]",+ "sinksConfig": {+ "sink": [+ {+ "name": "WADMetricJsonBlob",+ "type": "JsonBlob"+ }+ ]+ }+ }+ }+ }+ ] } } }

Finally, add an autoscaleSettings resource to configure autoscale based on these metrics. This resource has a dependsOn clause that references the scale set to ensure that the scale set exists before attempting to autoscale it. If you choose a different metric to autoscale on, you would use the counterSpecifier from the diagnostics extension configuration as the metricName in the autoscale configuration. For more information on autoscale configuration, see the autoscale best practices and the Azure Monitor REST API reference documentation.

+ },+ {+ "type": "Microsoft.Insights/autoscaleSettings",+ "apiVersion": "2015-04-01",+ "name": "guestMetricsAutoscale",+ "location": "[resourceGroup().location]",+ "dependsOn": [+ "Microsoft.Compute/virtualMachineScaleSets/myScaleSet"+ ],+ "properties": {+ "name": "guestMetricsAutoscale",+ "targetResourceUri": "[resourceId('Microsoft.Compute/virtualMachineScaleSets', 'myScaleSet')]",+ "enabled": true,+ "profiles": [+ {+ "name": "Profile1",+ "capacity": {+ "minimum": "1",+ "maximum": "10",+ "default": "3"+ },+ "rules": [+ {+ "metricTrigger": {+ "metricName": "/builtin/memory/percentUsedMemory",+ "metricNamespace": "",+ "metricResourceUri": "[resourceId('Microsoft.Compute/virtualMachineScaleSets', 'myScaleSet')]",+ "timeGrain": "PT1M",+ "statistic": "Average",+ "timeWindow": "PT5M",+ "timeAggregation": "Average",+ "operator": "GreaterThan",+ "threshold": 60+ },+ "scaleAction": {+ "direction": "Increase",+ "type": "ChangeCount",+ "value": "1",+ "cooldown": "PT1M"+ }+ },+ {+ "metricTrigger": {+ "metricName": "/builtin/memory/percentUsedMemory",+ "metricNamespace": "",+ "metricResourceUri": "[resourceId('Microsoft.Compute/virtualMachineScaleSets', 'myScaleSet')]",+ "timeGrain": "PT1M",+ "statistic": "Average",+ "timeWindow": "PT5M",+ "timeAggregation": "Average",+ "operator": "LessThan",+ "threshold": 30+ },+ "scaleAction": {+ "direction": "Decrease",+ "type": "ChangeCount",+ "value": "1",+ "cooldown": "PT1M"+ }+ }+ ]+ }+ ]+ } } ] }

Next steps

You can deploy the preceding template by following the Azure Resource Manager documentation.

You can start this tutorial series from the basic scale set template article.

You can see how to modify the basic scale set template to deploy the scale set into an existing virtual network.

You can see how to modify the basic scale set template to deploy the scale set with a custom image.

You can see how to modify the basic scale set template to deploy a Linux scale set with guest-based autoscale.

For more information about scale sets, refer to the scale set overview page.

Use Azure autoscale with guest metrics in a Linux scale set template - Azure Virtual Machine Scale Sets (2024)
Top Articles
Discover the Best Book Review Sites of 2024: Top 10 Picks
do english speakers understand german and dutch? well, I believe this idea, because according to the definition english is a german language or something like that, I can't remember very well my class
How To Start a Consignment Shop in 12 Steps (2024) - Shopify
Dunhams Treestands
Ron Martin Realty Cam
Obor Guide Osrs
Western Union Mexico Rate
Best Cheap Action Camera
GAY (and stinky) DOGS [scat] by Entomb
Self-guided tour (for students) – Teaching & Learning Support
Aktuelle Fahrzeuge von Autohaus Schlögl GmbH & Co. KG in Traunreut
Define Percosivism
Lancasterfire Live Incidents
Morristown Daily Record Obituary
Daytonaskipthegames
Mj Nails Derby Ct
Air Quality Index Endicott Ny
A Person That Creates Movie Basis Figgerits
683 Job Calls
The best brunch spots in Berlin
Sound Of Freedom Showtimes Near Movie Tavern Brookfield Square
fft - Fast Fourier transform
Restaurants In Shelby Montana
Xxn Abbreviation List 2017 Pdf
Cowboy Pozisyon
Spectrum Outage in Queens, New York
Turns As A Jetliner Crossword Clue
Our Leadership
Proto Ultima Exoplating
Kamzz Llc
Publix Coral Way And 147
Poster & 1600 Autocollants créatifs | Activité facile et ludique | Poppik Stickers
آدرس جدید بند موویز
Solemn Behavior Antonym
Wsbtv Fish And Game Report
Aliciabibs
8 Ball Pool Unblocked Cool Math Games
Sabrina Scharf Net Worth
Craigslist Pa Altoona
Tunica Inmate Roster Release
Courtney Roberson Rob Dyrdek
How To Customise Mii QR Codes in Tomodachi Life?
Quaally.shop
Europa Universalis 4: Army Composition Guide
Wolf Of Wallstreet 123 Movies
Dlnet Deltanet
Abigail Cordova Murder
How to Do a Photoshoot in BitLife - Playbite
The Hardest Quests in Old School RuneScape (Ranked) – FandomSpot
Grandma's Portuguese Sweet Bread Recipe Made from Scratch
Latest Posts
Article information

Author: Greg Kuvalis

Last Updated:

Views: 5748

Rating: 4.4 / 5 (75 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Greg Kuvalis

Birthday: 1996-12-20

Address: 53157 Trantow Inlet, Townemouth, FL 92564-0267

Phone: +68218650356656

Job: IT Representative

Hobby: Knitting, Amateur radio, Skiing, Running, Mountain biking, Slacklining, Electronics

Introduction: My name is Greg Kuvalis, I am a witty, spotless, beautiful, charming, delightful, thankful, beautiful person who loves writing and wants to share my knowledge and understanding with you.