azure rest api virtual machine cpu usage

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

Upvotes: 0

Views: 2151

Answers (1)

Shui shengbao
Shui shengbao

Reputation: 19223

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.

Upvotes: 1

Related Questions