Hello,
I want to make my own custom sensor which provides the same information as the predefined wmiprocesssensor (CPU Usage, Handles, Instances etc.) BUT ALSO is able to monitor the process memory usage >4GB which is mentioned here:
https://helpdesk.paessler.com/en/support/solutions/articles/60640-wmi-process-64-bit-os-4-gb-ram
But for this I need to know how the wmiprocesssensor does the CPU Usage calculation. Is there a source file for this sensor where I can check how it is calculated?
Article Comments
You can use the following simple query to get a hosts's CPU usage via Powershell:
$var = Get-WmiObject -Query "SELECT Name, PercentProcessorTime FROM Win32_PerfFormattedData_PerfOS_Processor"
Foreach ($a in $var) {
Write-Output "Core #$($a.Name) = $($a.PercentProcessorTime) %"
}
The values are returned in %, no additional calculation is necessary. You will just need to make the formating PRTG friendly and include the Invoke-Command, remoting, credentials and everything else that needs to be done for this to "work" within PRTG. This is the bare minimum example/POC.
Best Regards,
Luciano Lingnau [Paessler Support]
Jan, 2018 - Permalink
You can use the following simple query to get a hosts's CPU usage via Powershell:
The values are returned in %, no additional calculation is necessary. You will just need to make the formating PRTG friendly and include the Invoke-Command, remoting, credentials and everything else that needs to be done for this to "work" within PRTG. This is the bare minimum example/POC.
Best Regards,
Luciano Lingnau [Paessler Support]
Jan, 2018 - Permalink