整个查询由WVDConnection、Perf处理器和Perf内存这两个不同的部分组成。他们能够单独运行,但不能作为一个整体运行。我得到的错误“没有结果发现从过去24小时尝试选择另一个时间范围”。我已经将时间范围更改为30分钟,输出是相同的。查询在日志分析工作区上运行。输出示例(用户名、CPU利用率和内存利用率)我是否遗漏了什么?
查询和输出如下:enter image description here
//list all users in a hostpool
WVDConnections
| where _ResourceId =~ 'resource id of hostpool'
//CPU and memory utilization
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
| summarize CPUUtilization = avg(CounterValue) by TimeGenerated
) on TimeGenerated
| join kind=inner (
Perf
| where ObjectName == "Memory" and CounterName == "Available MBytes"
| summarize MemoryUtilization = avg(CounterValue) by TimeGenerated
) on TimeGenerated
| project TimeGenerated, CPUUtilization, MemoryUtilization
//The whole query after joining both altogether
WVDConnections
| where _ResourceId =~ 'resource id of hostpool'
| project CorrelationId, State, TimeGenerated, UserName
| summarize TimeGenerated=min(TimeGenerated) by CorrelationId, State, UserName
| join kind=inner (
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
| summarize CPUUtilization = avg(CounterValue) by TimeGenerated
) on TimeGenerated
| join kind=inner (
Perf
| where ObjectName == "Memory" and CounterName == "Available MBytes"
| summarize MemoryUtilization = avg(CounterValue) by TimeGenerated
) on TimeGenerated
| project TimeGenerated, UserName, CPUUtilization, MemoryUtilization
1条答案
按热度按时间c2e8gylq1#
整个查询由WVDConnection、Perf处理器和Perf内存这两个不同的部分组成。他们能够单独运行,但不能作为一个整体运行。
您可以使用下面的
KQL
查询在单个查询中获得Processor
和Memory
结果。第一种方式:
输出:
第二种方法:
我使用了
join
运算符来合并基于TimeGenerated
列的ProcessorData
和MemoryData
表。输出: