Azure log analytics, memory result not showing

655 views Asked by At

I wanted to get the performance report of my azure VMs using log analytics. I found a blog here

which shows what I wanted.

The problem is when I run the code in my log analytics, it gives all the details except FreeMemoryGB and TotalMemoryGB as shown in the screenshot in the blog. It just shows blank space.

Thanks

1

There are 1 answers

6
Ecstasy On

Thank you Arun and KrishnaG-MSFT. Posting your suggestions as an answer to help other community members.

"% Used Memory" is a counter available for Linux boxes only. For Windows "% Committed Bytes In Use" is the closest which can give the current memory in use for any windows VM.

Perf
| where TimeGenerated > ago(30m)
| where  CounterName == "% Committed Bytes In Use" 
| project TimeGenerated, CounterName, CounterValue, Computer
| summarize UsedMemory = avg(CounterValue) by CounterName, bin(TimeGenerated, 1m), Computer
| where UsedMemory > 20 
| render timechart

If your Azure VM is Windows OS then query to find disk total free space is:

Perf
| where ( ObjectName == "LogicalDisk" )
| where ( CounterName == "% Free Space" )
| where ( InstanceName == "_Total" )
| summarize AggregatedValue= avg(CounterValue) by Computer, bin(TimeGenerated, 30s)

You can refer to Read Windows VM RAM Memory Log Analytics Query and Is there any API to query an Azure VM for free disk/memory space?