azure cli does not recognise guest metrics

R, Nanda Kumar 0 Reputation points
2023-03-28T14:03:44.4033333+00:00

I have deployed a VMSS and trying to configure auto scaling rule based on Guest OS metrics from Monitor agent extension.
I'm able to configure the autoscale rule from Portal but CLI command fails to recognise guest OS metrics. What could be the issue here? I don't any helpful doc around this topic

root@0ac2a8a4db55:~# az monitor autoscale rule create --resource-group ls1-cpabs-11583-rg --autoscale-name ls1-cpabs-11583-router-scaleset-001 --condition 'azure.vm.linux.guestmetrics mem/available_percent > 75 avg 10m' --scale out 1 (UnsupportedMetric) resource: /subscriptions/64303c43-fd17-4f89-818b-61330290b619/resourceGroups/ls1-cpabs-11583-rg/providers/Microsoft.Compute/virtualMachineScaleSets/ls1-cpabs-11583-router-scaleset-001, metricnamespace: metricNamespace is null, metricname: azure.vm.linux.guestmetrics mem/available_percent Code: UnsupportedMetric Message: resource: /subscriptions/64303c43-fd17-4f89-818b-61330290b619/resourceGroups/ls1-cpabs-11583-rg/providers/Microsoft.Compute/virtualMachineScaleSets/ls1-cpabs-11583-router-scaleset-001, metricnamespace: metricNamespace is null, metricname: azure.vm.linux.guestmetrics mem/available_percent root@0ac2a8a4db55:~#

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,783 questions
Azure Virtual Machine Scale Sets
Azure Virtual Machine Scale Sets
Azure compute resources that are used to create and manage groups of heterogeneous load-balanced virtual machines.
345 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Samuel Strain 15 Reputation points
    2023-03-29T16:00:16.09+00:00

    It looks like you're having trouble with the Azure CLI not recognizing guest OS metrics when creating an autoscale rule for a VMSS. The issue might be due to the formatting of the metric name in the command.

    In your command, you're using: 'azure.vm.linux.guestmetrics mem/available_percent > 75 avg 10m'

    Instead, you should try using the metric namespace and metric name separately like this:

    --metric-namespace 'azure.vm.linux.guestmetrics' --metric-name 'mem/available_percent'

    So, your full command would look like:

    cssCopy code
    az monitor autoscale rule create --resource-group ls1-cpabs-11583-rg --autoscale-name ls1-cpabs-11583-router-scaleset-001 --metric-namespace 'azure.vm.linux.guestmetrics' --metric-name 'mem/available_percent' --operator '>' --threshold 75 --aggregation 'Average' --window-size '10m' --scale out 1
    

    Give this a try and see if it resolves the issue. If you still face problems, consider checking the Azure CLI version and updating it if needed. Good luck!

    1 person found this answer helpful.