From what I can see, it is not possible to use another items value in a preprocessor.
Having this functionality would be useful for the following scenario.
Background:
When backups run on our servers, an agent runs as a low priority process, but uses as much CPU as it can. This results in ‘High CPU utilization’ alerts, which although true, do not indicate a performance issue, as the backup will be allocated less CPU if other processes need it.
Attempted solution:
New item:
New Trigger:
Updated trigger:
Discussion on attempted solution:
Preprocessor 1 above will sum up all the values of the percentage processor time for all entries which aren’t the idle process nor the _total process. The sum can up to <number of cores>*100%.
To get a total CPU percentage, rather than per core percentage, we need to divide by the number of cores, which can be obtain from last(/Windows by Zabbix agent active/wmi.get[root/cimv2,"Select NumberOfLogicalProcessors from Win32_ComputerSystem"])
Preprocessor 2 is not accepted with the error 'Incorrect value for field "params": a numeric value is expected.'
Options considered:
I considered using a calculated item, with the formula:
I also considered a using dependant item. It doesn't have the lag issue, but has the same issue as a preprocessor on the the base item, as processing of dependent items is done by preprocessors.
Workaround used:
As a workaround I have not created preprocessor 2, and I have moved the division into the trigger:
Having this functionality would be useful for the following scenario.
Background:
When backups run on our servers, an agent runs as a low priority process, but uses as much CPU as it can. This results in ‘High CPU utilization’ alerts, which although true, do not indicate a performance issue, as the backup will be allocated less CPU if other processes need it.
Attempted solution:
New item:
Name: PercentProcessorTime For Below Normal priority processes
Key: wmi.getall[root\cimv2,"SELECT IDProcess,PercentProcessorTime FROM win32_PerfFormattedData_PerfProc_Process WHERE PriorityBase<8"]
Preprocessor 1: JSONPath: $.[?(@.IDProcess>"0")].PercentProcessorTime.sum()
Preprocessor 2: Custom multiplier: {? 1/ last(/Windows by Zabbix agent active/wmi.get[root/cimv2,"Select NumberOfLogicalProcessors from Win32_ComputerSystem"])}
Key: wmi.getall[root\cimv2,"SELECT IDProcess,PercentProcessorTime FROM win32_PerfFormattedData_PerfProc_Process WHERE PriorityBase<8"]
Preprocessor 1: JSONPath: $.[?(@.IDProcess>"0")].PercentProcessorTime.sum()
Preprocessor 2: Custom multiplier: {? 1/ last(/Windows by Zabbix agent active/wmi.get[root/cimv2,"Select NumberOfLogicalProcessors from Win32_ComputerSystem"])}
New Trigger:
Name: High background process CPU usage in last 5 minutes
Expression: max(/Windows by Zabbix agent active/wmi.getall[root\cimv2,"SELECT IDProcess,PercentProcessorTime FROM win32_PerfFormattedData_PerfProc_Process WHERE PriorityBase<8"],5m) >50
Severity: Information
Expression: max(/Windows by Zabbix agent active/wmi.getall[root\cimv2,"SELECT IDProcess,PercentProcessorTime FROM win32_PerfFormattedData_PerfProc_Process WHERE PriorityBase<8"],5m) >50
Severity: Information
Updated trigger:
Name: High CPU utilization
Depends on: High background process CPU usage in last 5 minutes
Depends on: High background process CPU usage in last 5 minutes
Discussion on attempted solution:
Preprocessor 1 above will sum up all the values of the percentage processor time for all entries which aren’t the idle process nor the _total process. The sum can up to <number of cores>*100%.
To get a total CPU percentage, rather than per core percentage, we need to divide by the number of cores, which can be obtain from last(/Windows by Zabbix agent active/wmi.get[root/cimv2,"Select NumberOfLogicalProcessors from Win32_ComputerSystem"])
Preprocessor 2 is not accepted with the error 'Incorrect value for field "params": a numeric value is expected.'
Options considered:
I considered using a calculated item, with the formula:
last(/Windows by Zabbix agent active/wmi.getall[root\cimv2,"SELECT IDProcess,PercentProcessorTime FROM win32_PerfFormattedData_PerfProc_Process WHERE PriorityBase<8"]) / last(/Windows by Zabbix agent active/wmi.get[root/cimv2,"Select NumberOfLogicalProcessors from Win32_ComputerSystem"])
however, the calculated item will lag the measured item, as it runs on its own schedule.I also considered a using dependant item. It doesn't have the lag issue, but has the same issue as a preprocessor on the the base item, as processing of dependent items is done by preprocessors.
Workaround used:
As a workaround I have not created preprocessor 2, and I have moved the division into the trigger:
( max(/Windows by Zabbix agent active/wmi.getall[root\cimv2,"SELECT IDProcess,PercentProcessorTime FROM win32_PerfFormattedData_PerfProc_Process WHERE PriorityBase<8"],5m) / last(/Windows by Zabbix agent active/wmi.get[root/cimv2,"Select NumberOfLogicalProcessors from Win32_ComputerSystem"])
) > 50
However this means that I when I graph the item ‘PercentProcessorTime For Below Normal priority processes’ it maxes out at <number of cores>*100%, rather than 100%, which is not useful when graphing alongside ‘CPU privileged time’, and ‘CPU utilization’.) > 50