KQL Query to check CPU utilization and memory utilization of each user in the AVD environment

Syed Harith Zaki 0 Reputation points
2024-06-07T03:58:30.42+00:00

Hi,

I am trying to use KQL query to check the CPU utilization based on the performance counter of "Process/% Processor Time" and memory utilization based on the performance counter of "Process/Private Bytes" according to each user in the AVD setup. In the perf table, there are no parameters for the username only the computer. Is there any way I can do this using the join or union operator?

Thanks for any help or suggestion.

Azure Virtual Desktop
Azure Virtual Desktop
A Microsoft desktop and app virtualization service that runs on Azure. Previously known as Windows Virtual Desktop.
1,430 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anveshreddy Nimmala 3,460 Reputation points Microsoft Vendor
    2024-06-07T05:04:28.04+00:00

    Hello Syed Harith Zaki,

    Welcome to microsoft Q&A, thankyou for posting your query here.

    The whole query is made up of 2 different parts WVD Connection, Perf processor and Perf memory.

    Perf
    | where (ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total")
        or (ObjectName == "Memory" and CounterName == "Available MBytes")
    | summarize avg(CounterValue) by TimeGenerated, ObjectName, CounterName, InstanceName
    | project TimeGenerated, ObjectName, CounterName, InstanceName, CounterValue = avg_CounterValue
    

    use the join operator to combine the ProcessorData and MemoryData tables based on the TimeGenerated column.

    let ProcessorData = Perf
    | where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
    | summarize CPUUtilization = avg(CounterValue) by TimeGenerated;
    let MemoryData = Perf
    | where ObjectName == "Memory" and CounterName == "Available MBytes"
    | summarize MemoryUtilization = avg(CounterValue) by TimeGenerated;
    ProcessorData
    | join kind=inner MemoryData on TimeGenerated
    | project TimeGenerated, CPUUtilization, MemoryUtilization;
    
    

    Hope this helps you.

    0 comments No comments