Azure Virtual Machine Memory Counter Values in an Azure Dashboard

Published On: 2021-06-01By:

Recently a client asked me to put the memory usage for their Virtual Machines on an Azure Dashboard. Sadly this metric isn’t available in the normal Azure Dashboard selection. The available metrics are related to CPU, Network, and Disk (IO) but not the memory of the virtual machine.

To pull up the memory data I had to work through a couple of easy steps. The first step was to feed data to Azure Log Analytics. After that a quick KQL query would pull the most recent memory counter data. The needed KQL query is pretty straight forward.

Perf
| where ObjectName == "Memory" and
(   CounterName == "% Committed Bytes In Use" 
)
|  summarize avg(CounterValue) by bin(TimeGenerated, 15min), Computer, _ResourceId 
| render timechart

If you want to filter this down to a set of specific machines that can be done by adding in a little bit to the where clause of the KQL script to match the computer name. In the example KQL code below we are looking for all the machines with “Web” in the machine name. This is done by adding ‘and Computer contains “Web”‘ into the where clause of the script.

Perf
| where ObjectName == "Memory" and Computer contains "Web" and
(   CounterName == "% Committed Bytes In Use" 
)
|  summarize avg(CounterValue) by bin(TimeGenerated, 15min), Computer, _ResourceId 
| render timechart

When the first sample query is run it’ll produce a graph similar to the one shown below. Each line is a separate Azure Virtual Machine (the machine names aren’t being shown for obvious reasons). Several different chart options are available from Log Analytics, but personally, I prefer a line chart for this (Meagan may disagree with me here, and she’s probably correct but I’m stubborn).

Once the script is created push the Pin to dashboard button and the graph (and the script which creates it) will be pushed to the dashboard which you select.

Once the script is pushed to a dashboard the graph can be seen much like the one below. You can edit the properties and make the title and subtitle a little more useful. By default, the values will be pretty useless but you can make them meaningful.

Once that’s done you have the memory counters for the selected virtual machines on an Azure Dashboard.

Denny

Contact the Author | Contact DCAC

Video

Globally Recognized Expertise

As Microsoft MVP’s and Partners as well as VMware experts, we are summoned by companies all over the world to fine-tune and problem-solve the most difficult architecture, infrastructure and network challenges.

And sometimes we’re asked to share what we did, at events like Microsoft’s PASS Summit 2015.

Awards & Certifications

Microsoft Partner   Denny Cherry & Associates Consulting LLC BBB Business Review    Microsoft MVP    Microsoft Certified Master VMWare vExpert
American Business Award 2021 Gold    American Business Award 2021 Bronze    FT Americas’ Fastest Growing Companies 2021   INC 5000 Award for 2020    American Business Awards People's Choice    American Business Awards Gold Award    American Business Awards Silver Award
FT Americas’ Fastest Growing Companies 2020       Best Full-Service Cloud Technology Consulting Company       Insights Sccess Award    Technology Headlines Award
Share via
Copy link