SOLVED

How to get the Peak CPU on Log Analytics

Copper Contributor

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 game is looking for CPU consumption during the month and get the VMs that the CPU consumption is < 2%, to decommission.

Tks so much.

2 Replies
best response confirmed by Lucas Chies (Copper Contributor)
Solution

@Lucas Chies 

 

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

 


Annotation 2019-04-23 150944.png

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.

Annotation 2019-04-23 152447.png

 

 

Hello @CliveWatson , tks for your help.

I'll follow your points, I'm also have a lot of VMs and many teams here, some times, estimates an big VM for one little service consumption and this will help to view what's the VMs and I can use with evidence to resize or decommission those VM.

 

Tks so much again

1 best response

Accepted Solutions
best response confirmed by Lucas Chies (Copper Contributor)
Solution

@Lucas Chies 

 

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

 


Annotation 2019-04-23 150944.png

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.

Annotation 2019-04-23 152447.png

 

 

View solution in original post