squaredup / Community.DataOnDemand.MP

The Data on Demand Management Pack contains a number of useful System Center Operations Manager (SCOM) agent tasks, including the Netstat task required by Squared Up Visual Application Discovery & Analytics.
GNU General Public License v3.0
4 stars 2 forks source link

Get processes task incorrectly reports CPU percent column #28

Closed shadeon closed 7 years ago

shadeon commented 7 years ago

The CPU Percent value returned by the task is based on a WMI perf counter that is capped at the value of 100. On multi-core systems where threads are being run across multiple cores, the time value will likely exceed 100. This can cause wildly inaccurate figures on systems that have a large number of cores.

To resolve this, we instead need to collect the CPU % for each thread in the process (via Win32_PerfFormattedData_PerfProc_Thread, ignoring any instances matching _Total) and sum them, dividing by the total number of logical cores.

In addition, many of the other properties are actually available on the System.Diagnostics.Process class - the only one that is not is the Creating process - this value could instead be queried from the WMI_Process class.