Forum Discussion

Lucas Chies's avatar
Lucas Chies
Copper Contributor
Apr 23, 2019
Solved

How to get the Peak CPU on Log Analytics

Hello team,   I need to get the avg of cpu for VMs and this I know how get this, but I also need another thing that's the Peak of CPU, to checking if I don't have any false positive. The end ga...
  • CliveWatson's avatar
    Apr 23, 2019

    Lucas Chies 

     

    There are CPU examples - you can launch from the portal, like this one:

     


    I'm not sure I'd decommission a server based on just low CPU use.  

    I'd amend the query like this (you can also replace "avg" with "max" ).  I added in a filter for < 10% only (you can use 2%) and a filter for machines that names start with "A" as I have a lot of servers :-)

    // CPU usage trends over the last day
    // Calculate CPU usage patterns across all computers, chart by percentiles
    Perf
    | where Computer startswith "A" 
    | where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
    | where CounterValue < 10
    | summarize avg(CounterValue) by bin(TimeGenerated, 1h) , Computer
    | render timechart

    e.g.  Computers less than 2% in past 31days - none of which I'd decommission as they are low use, and I know why.

     

     

Resources