QuestionHow do I monitor the CPU usage of a process?
When trying to monitor the CPU usage of a process, the sum of percent utilization from each CPU core is returned instead of a value from 1-100.
Answer
Follow these steps to accurately monitor the CPU usage of a process:
- Create a new agent-based Performance Counter metric with the following values:
Name: [process name] % Processor Time
Polling interval: 60 (or preferred interval)
Performance object: Process
Counter: % Processor Time
Instance: [process name] (name only, no .exe extension)
- Create a new agent-based WMI metric with the following values:
Name: Number of processors
Polling interval: 3600
Timeout: 60
Data type: Numeric
Namespace: root\cimv2
Query: WQL string: select NumberOfProcessors from Win32_ComputerSystem
- Create a new Compound metric with the following values:
Name: [process name] actual % Processor Time
Polling interval: 60 (or preferred interval)
Metric variables: a = [name of Performance Counter metric], b = [name of WMI metric]
Equation: (a/b)
- Create a new rule which references the compound metric with a condition which meets your monitoring needs (e.g. "AeXsvc actual % Processor Time", "Average", "10 minutes", "Is greater than or equal to", "Constant", "80").
This will take the sum of CPU usage for each processor and divide it by the number of processors returning a value of 0-100. With the WMI metric for number of processors already created, you can re-use it with any additional process you wish to monitor. The polling interval for the WMI metric is every hour because it is not a dynamic value and does not need to be polled on a frequent basis.