1

我一直在处理 Log Analytics 工作区查询,我想知道 windows VM 正在使用的内存(RAM)特别是,在 linux vm 中,我们可以从中获取它,% Used Memory counter尽管无法获取 Windows VM。Linux 已用内存查询如下图所示:

// 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
4

2 回答 2

1

这对于 Windows vms 的工作方式几乎相同,但您需要配置您收集哪些计数器,然后此查询才能工作。

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

于 2019-12-09T18:21:39.787 回答
1

@Sachin:你是对的。“% Used Memory”是仅适用于 Linux 机器的计数器。对于 Windows,“% Committed Bytes In Use”是最接近的,它可以为您提供任何 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
于 2019-12-10T08:00:31.473 回答