Is there any cli command to get cpu utilisation % of a vmss instance?

Smita Mohapatra 41 Reputation points

I wanna see cpu utilisation of a instance of VM Scaleset. Is there any cli command to fetch the same.

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

Accepted answer
  1. Prrudram-MSFT 21,886 Reputation points

    Hello @Smitamohapatra88 ,

    Thank you for reaching out to Microsoft Q&A platform. Happy to answer your question.
    Azure Monitor is the best way to interact with metrics, including charting them in the Azure portal, accessing them through the REST API, or querying them by using PowerShell or the Azure CLI.

    This article is a complete list of all platform (that is, automatically collected) metrics currently available with the consolidated metric pipeline in Azure Monitor.
    Please look in to the VMSS section for details.

    Another way is to use portal and is described here microsoft-azure-get-cpu-utilization-data-of-a-azure-vm-in-azure-portal
    If you are only looking for CLI way, then Get-AzMetric is command -MetricName "Percentage CPU"
    Actually, the information under Metrics in the portal is for the web role, get-azmetric

    PS D:\testdata> (Get-AzMetricDefinition -ResourceId $id).name

    Value LocalizedValue
    ----- --------------
    Percentage CPU Percentage CPU
    Network In Network In
    Network Out Network Out
    Disk Read Bytes Disk Read Bytes
    Disk Write Bytes Disk Write Bytes
    Disk Read Operations/Sec Disk Read Operations/Sec
    Disk Write Operations/Sec Disk Write Operations/Sec
    CPU Credits Remaining CPU Credits Remaining
    CPU Credits Consumed CPU Credits Consumed

    (If the response was helpful please don't forget to upvote and accept as answer, thank you)

    0 comments No comments

0 additional answers

Sort by: Most helpful