Search code examples
cpuwmisql-server-2019dynamic-management-views

sys.dm_os_ring_buffers vs wmi query for cpu


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


Solution

  • 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