0
votes

I am trying to retrieve the CPU Usage for a Virtual Machine from the Azure Cloud using the REST API, at this time i have the GET URL to obtain the details for a specific Virtual Machine, but i cant find the URL GET for the metrics for the Virtual Machine, mi URL is:

https://management.azure.com/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/virtualMachines/{}/?api-version=2016-04-30-preview

The {} has the correct values and at this time i am retrieving the details of the Virtual Machine, but i need the statistics of usage for a specific Virtual Machine

1
The api you used only could get Azure VM information, if you want to get vm cpu usage, you should use azure monitor rest api. You could check my answer.Shui shengbao

1 Answers

0
votes

You could use Azure Monitor Rest API to get VM's Percentage CPU usage. For example:

https://management.azure.com/subscriptions/******/resourceGroups/shuilinux/providers/Microsoft.Compute/virtualMachines/shui/providers/microsoft.insights/metrics?api-version=2016-09-01

I test in Postman.

enter image description here

Azure monitoring-supported-metrics you could check this link.