Hi there.
I know that many of you have solved the problem of getting data about CPU usage by any process or group of processes on Windows platforms-in a different way.
But I would like to share our experience. May be it will save time and nervous for some one.
under test :
Windows 10, few windows of "MS Edge" and online CPU stress test tabs ( https://cpux.net/cpu-stress-test-online )
PS, instead of "sqlsrvr" on screenshots - use "msedge"
this task was resolved by few different way :
1) PowerShell script on local computer
2) PowerShell command through zabbix checks
3) WMI.
by after testing under load (check attachments), the most preferable way - only one (WMI)

To implement this way, you should :
1) create 3 item :
a)
with key = wmi.getall["ROOT\CIMV2","SELECT PercentUserTime FROM Win32_PerfFormattedData_PerfProc_Process where Name like '%sqlservr%'"]
b)
c) with preprocessing steps:
var line_array = value.split(',');
var result = 0.0;
for (var i=0; i<line_array.length; i++) {
cur_value = line_array[i].match(/[(\d.)]+/g);
if ('' != cur_value) {
result += parseFloat(cur_value);
}
}
return result;

3) with formula :
last("wmi.getall["ROOT\CIMV2","SELECT PercentUserTime FROM Win32_PerfFormattedData_PerfProc_Process where Name like '%sqlservr%'"]")/last("system.cpu.num")

As result, you will get pretty similar data as in Task Manager
I know that many of you have solved the problem of getting data about CPU usage by any process or group of processes on Windows platforms-in a different way.
But I would like to share our experience. May be it will save time and nervous for some one.
under test :
Windows 10, few windows of "MS Edge" and online CPU stress test tabs ( https://cpux.net/cpu-stress-test-online )
PS, instead of "sqlsrvr" on screenshots - use "msedge"
this task was resolved by few different way :
1) PowerShell script on local computer
2) PowerShell command through zabbix checks
3) WMI.
by after testing under load (check attachments), the most preferable way - only one (WMI)
To implement this way, you should :
1) create 3 item :
a)
with key = wmi.getall["ROOT\CIMV2","SELECT PercentUserTime FROM Win32_PerfFormattedData_PerfProc_Process where Name like '%sqlservr%'"]
b)
c) with preprocessing steps:
var line_array = value.split(',');
var result = 0.0;
for (var i=0; i<line_array.length; i++) {
cur_value = line_array[i].match(/[(\d.)]+/g);
if ('' != cur_value) {
result += parseFloat(cur_value);
}
}
return result;
3) with formula :
last("wmi.getall["ROOT\CIMV2","SELECT PercentUserTime FROM Win32_PerfFormattedData_PerfProc_Process where Name like '%sqlservr%'"]")/last("system.cpu.num")
As result, you will get pretty similar data as in Task Manager
Comment