Forum Discussion
Niraj875
Apr 01, 2020Copper Contributor
Get count of instances where CPU Utilization is higher than 90% using PS
Hello, I'm trying to implement a functionality to check how many times within a span of 3 minutes, the CPU utilization was higher than 90%. I'm sampling 180 values of CPU utilization in 3 minutes...
- Apr 02, 2020
Hello Niraj875
by filtering the values like this:
$cpuUtil = (get-counter -Counter "\Processor(_Total)\% Processor Time" -SampleInterval 1 -MaxSamples 180 | select -ExpandProperty countersamples | select -ExpandProperty cookedvalue |Where-Object -FilterScript { $_ -gt 90 } | Measure-Object).Count
JoP_SG
Copper Contributor
Hello Niraj875
by filtering the values like this:
$cpuUtil = (get-counter -Counter "\Processor(_Total)\% Processor Time" -SampleInterval 1 -MaxSamples 180 | select -ExpandProperty countersamples | select -ExpandProperty cookedvalue |Where-Object -FilterScript { $_ -gt 90 } | Measure-Object).Count