Getting average CPU and Memory usage for all azure VMs in a resource group

Anonymous
2022-11-18T09:01:02.827+00:00

Hello,

I am trying to get average cpu & memory utilization for VMs in a resource group via script so I can export the required details to a CSV file. I have a mix of linux & windows VMs within this RG. Tried a PS script with get-wmiobject module with a checkpoint condition ( with test-path) but this seems to give me the null output even for the windows vm . Are there azure cli/ powershell commands that can give this? Explored azuremetrics module but looks like this does not provide average memory utilization. Any pointers towards the right direction would be much appreciated.

I tried the PS script provided at https://www.powershellbros.com/run-script-to-check-cpu-and-memory-utilization/

Thanks & Regards
Suneel

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,544 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. srbhatta-MSFT 8,551 Reputation points Microsoft Employee
    2022-11-22T05:25:04.807+00:00

    Hi @Anonymous ,
    The script link that you have posted is a custom Powershell script so you have to tweak that according to your requirements.
    Also, are you looking to specifically export the required details to a csv automatically?
    If not, then you can also check these metrics from the Portal-> under your VM -> Monitoring.