Obtaining CPU utilization metrics after a VM instance has terminated?

PeterT 21 Reputation points
2022-02-16T14:49:18.463+00:00

I'm using the Azure Monitor API to obtain CPU utilization metrics for VM instances. This is possible when a VM instance is running or stopped, but once an instance is terminated I'm unable to obtain historical CPU data because the resource is not found.

Is there a way of accessing historical CPU metrics after an instance has terminated?

(Use case: performing analytics on batch processing tasks, where VMs are started for a task, and terminated once the task is complete.)

Thanks for any help you can offer.

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,812 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,164 questions
0 comments No comments
{count} votes

Accepted answer
  1. Alan Kinane 16,786 Reputation points MVP
    2022-02-16T16:13:43.043+00:00

    You can use a data ingestion service like log analytics - https://learn.microsoft.com/en-us/azure/azure-monitor/agents/log-analytics-agent#install-and-configure-agent
    to collect performance data - https://learn.microsoft.com/en-us/azure/azure-monitor/agents/data-sources-performance-counters

    This data can be retained for up to 2 years and you can query the logs even if the VMs are deleted.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful