1

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
4c74356b41
  • 69,186
  • 6
  • 100
  • 141
Sachin Kalia
  • 1,027
  • 14
  • 24

2 Answers2

1

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

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
  • Hi, Thanks for your response though i'm more concerned about query . I've already gone through with the document shown above. Do you have an idea what will be a query to achieve above mentioned objective – Sachin Kalia Dec 10 '19 at 04:02
  • should be the same query – 4c74356b41 Dec 10 '19 at 04:28
1

@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
Arun
  • 324
  • 1
  • 8