Hello, @Alberto Mijares (Tantius) !
Outside of using the metrics API as mentioned by @Alistair Ross , there are a number of options available for viewing VM metrics (including CPU and memory) at once that may work for you.
How do I view or export Azure Monitor metrics (CPU utilization, Memory, etc.) for all VMs at once?
There are a good number of options when it comes to viewing Azure Monitor metrics for your VMs. These are just a couple:
1. Custom Dashboards and Azure Metrics Explorer
Dashboards are extremely helpful when collecting data and creating your own custom dashboard is a good way to get exactly the information you are interested in, especially if you pin a custom query. Here I've created a custom dashboard to show Average CPU Percentage as well as Average Available Memory for two VMs that are in different regions (and in separate scopes):
Create a dashboard in the Azure portal
View multiple resources in the Azure metrics explorer
- Go to the VM resource that you are interested in
- Go to Monitoring > Metrics
- Select the scope you are interested in
- Configure the filters to show the data you would like to see
- Click on Save to dashboard and then select Pin to dashboard
- Either use an existing dashboard or create a new dashboard
- Pin additional metrics from other resources/scopes as needed
2. VM Insights
VM Insights includes pre-built workbooks that allow you to monitor your entire set of Azure and hybrid virtual machines in a single interface. While there is no direct cost for VM insights, you are charged for its activity in the Log Analytics workspace. Here I've added two VMs from two separate resource groups into a workspace and I'm showing data for each VM's CPU utilization percentage. Note that I can filter by subscription, resource group, specific VMs, workspace locations, or workspaces as I am in this example:
VM Insights Overview
- From the portal, search for Monitor
- Select VM Insights from the overview page by clicking on View
- Enable VM Insights by clicking on Configure Insights
- Under Virtual Machines, view Not monitored and expand the resource groups with your VMs
- Click on Enable to enable VM Insights
- Configure monitoring (I used the same data collection rule)
- Click on the Performance tab under Virtual Machines
- Select Performance under View Workbooks > Performance Analysis
- Filter according to your needs (subscription, resource groups, VMs, workspaces, etc.)
3. Log Analytics and Custom Queries
This is probably the best option for what you are looking for but it does require a bit more query knowledge to fully take advantage of although the built in queries will address things like CPU usage and memory. If you are looking for a custom query, let us know so we can assist you with the Kusto (KQL) needed.
Additional Reading: