0

Is anyone using WMI to alert when cpu is over a threshold? Here is the query I'm using :
SELECT * FROM __InstanceModificationEvent WITHIN 600 WHERE TargetInstance ISA 'Win32_Processor' AND TargetInstance.LoadPercentage > 95

I am comparing the results to this using sys.dm_os_ring_buffers ; I recently got an alert from WMI but when I check the immediate history in sys.dm_os_ring_buffers, cpu barely hit 50% I've been scrubbing the internet about how wmi works and not just copy paste of the code.

Thanks

  • Is your CPU variable rate frequency (aka Turbo Boost), most modern ones are and this can mess up the calculations – Charlieface Jul 12 '21 at 23:53
  • @Charlieface , I don't know. I would need to ask. We are on a Virtual Server. Do you have any links about how that works or how how to read those results. I'm fairly new to sysadmin level cpu research. – user210084 Jul 13 '21 at 00:25
  • A virtual server is even more likely to have problems detecting exact CPU usage. Try `select * from Win32_Processor` in WMI, or the Performance tab in Task Manager if you can log in remotely – Charlieface Jul 13 '21 at 00:33

1 Answers1

0

I have a 4 core VM. So the WMI query returns results per core whereas the sys.dm_os_ring_buffers is the average. I ran the following in Powershell to determine this.

PS C:\Users\Administrator> get-wmiobject win32_processor | select LoadPercentage

(((Get-WmiObject win32_processor | select LoadPercentage).LoadPercentage) | Measure-Object -Average).Average