Extract All Azure VM's CPU and memory utilization data.

Jayesh Sawant 81 Reputation points
2023-10-18T07:22:02.3366667+00:00

HI Team,

We have requirement to extract CPU and memory utilization data of all Azure VM's across subscriptions for last 3 month.

i checked with metrics but it not worked for me

please can any one help.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,013 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Prrudram-MSFT 28,201 Reputation points Moderator
    2023-10-18T10:03:02.21+00:00

    Hi @Jayesh Sawant

    Thank you for reaching out to the Microsoft Q&A platform.

    As suggested by Sedat Salman, to extract CPU and memory utilization data of all Azure VMs across subscriptions for the last 3 months, you can use Azure Monitor. Azure Monitor provides a centralized platform for collecting, analyzing, and acting on telemetry data from Azure resources, including VMs.

    Here are high level steps you can follow:

    1. Enable Azure Monitor for your subscriptions if it is not already enabled. You can do this by going to the Azure portal, selecting "Monitor" from the left-hand menu, and following the prompts to enable Azure Monitor.
    2. Configure Azure Monitor to collect performance data for your VMs. You can do this by going to the Azure portal, selecting "Monitor" from the left-hand menu, selecting "Virtual machines" under "Monitoring solutions", and following the prompts to configure performance data collection.
    3. Once you have configured performance data collection, you can use Azure Monitor to query the data for the last 3 months. You can do this by going to the Azure portal, selecting "Monitor" from the left-hand menu, selecting "Metrics" under "Monitoring data", and selecting the appropriate subscription and VM resource type.
    4. From there, you can select the appropriate metrics, such as "Percentage CPU" and "Memory Usage" and set the time range to the last 3 months.
    5. You can then export the data to a CSV file for further analysis.

    Note that Azure Monitor has some limitations, such as a maximum data retention period of 90 days. If you need to retain data for longer than 90 days, you may need to use a third-party monitoring solution or export the data to a storage account for long-term retention.

    Reference: https://learn.microsoft.com/en-us/azure/azure-monitor/overview

    Please click "Accept as answer" if this helps.

    1 person found this answer helpful.
    0 comments No comments

  2. Sedat SALMAN 14,180 Reputation points MVP
    2023-10-18T07:58:01.2466667+00:00

    You would normally need to use a few Azure services and tools to extract CPU and memory utilization metrics for Azure VMs across subscriptions.

    • Azure Monitor: Azure Monitor collects and aggregates data from various sources, including Azure VMs.

    and also you can use other services

    • Get-AZ Log
    • Azure Automation
    • Azure Resource Graph

    if you utilize one of these services you can start to collect but without these services you cannot reach historical data

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.