读取Windows VM RAM内存日志分析查询

时间:2019-12-09 18:10:47

标签: azure azure-log-analytics kusto kusto-query-language

我一直在进行Log Analytics Workspace查询,在那里我想知道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

2 个答案:

答案 0 :(得分:1)

这对于Windows vms几乎一样,但是您需要配置要收集的计数器,然后该查询才能起作用。

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

答案 1 :(得分:0)

@Sachin:你是对的。 “%Used Memory”是仅适用于Linux机器的计数器。对于Windows,“最接近的已使用字节数”是最接近的,它可以为您提供任何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