How to get performance of a virtual machine in Azure?

Saiyam Jain 0 Reputation points
2023-02-16T13:24:19.37+00:00

I am trying to collect the Performance of a Virtual Machine like CPU Utilization, Available Memory, Logical Disk MB/s, and Logical Disk IOPS, which can be seen under Insights via console. I want to collect these data and save them into a CSV file. Is there any API to get the data with Avg, Min, Max, 50th, 90th, and 95th included?

I have tried the following solutions:

  1. az monitor metrics command: az monitor metrics list --resource {ResourceName} --metric "Percentage CPU"
  2. API: https://management.azure.com/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute/virtualMachines/{vm_name}/providers/microsoft.insights/metrics?api-version=2018-01-01&metricnames=Percentage CPU&timespan={start_time}/{end_time}&interval=PT1H&aggregation=average

3. Microsoft Azure Monitor Client Library (Python SDK): azure-mgmt-monitor

In all the above-mentioned approaches, Instead of CPU Utilization, I'm getting results of 'Percentage CPU', i.e., instead of Insights these approaches are giving metrics.

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,658 questions
{count} votes

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.