Sachin Kalia
Sachin Kalia

Reputation: 1107

Read Windows VM RAM Memory Log Analytics Query

I've been working on Log Analytics Workspace query, there i'd like to know about the memory(RAM) being use by windows VM Specially, in linux vm we can get it from % Used Memory counter though not able yo get Windows VM. Query for Linux Used memory is shown below:

// Memory usage
Perf
| where TimeGenerated > ago(30m)
| where  CounterName == "% Used Memory" 
| project TimeGenerated, CounterName, CounterValue, Computer
| summarize UsedMemory = avg(CounterValue) by CounterName, bin(TimeGenerated, 1m), Computer
| where UsedMemory > 20 
| render timechart

Upvotes: 1

Views: 2087

Answers (2)

Arun
Arun

Reputation: 324

@Sachin : You are right. "% Used Memory" is a counter available for Linux boxes only. For Windows "% Committed Bytes In Use" is the closest which can give you the current memory in use for any windows VM. The query can be the same what you have written but with the different counter name

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

Upvotes: 1

4c74356b41
4c74356b41

Reputation: 72181

this would work pretty much the same for windows vms, but you need to configure which counters do you gather, before this query can work.

https://learn.microsoft.com/en-us/azure/azure-monitor/platform/data-sources-performance-counters#configuring-performance-counters

Upvotes: 1

Related Questions