Zabbix UserParameter PowerShell Script Not Supported – CPU Monitoring Fix

cpu-usagepowershellprocesswindowszabbix

I'm new to zabbix and I'm trying to create custom User Parameter to Monitor CPU utility per process(Windows Machine).

I have a powershell script and a user parameter, I also added a new item under zabbix -> Configuration -> hosts, but I keep getting the Not Supported status and I ran out of potential blogs/solutions to help me.

Does anyone have an idea on what I'm missing / doing wrong ?

My user Parameter : UserParameter=checkcpuperprocess[*], C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -file C:\Zabbix\conf\CPUperProc.ps1

My powershell script :

    $properties=@(
        @{Name="Process Name"; Expression = {$_.name}},
        @{Name="CPU (%)"; Expression = {$_.PercentProcessorTime}},   
        @{Name="Memory (MB)"; Expression = {[Math]::Round(($_.workingSetPrivate / 1mb),2)}}
    )
    Get-WmiObject -class Win32_PerfFormattedData_PerfProc_Process |
        Select-Object $properties |
        Format-Table -AutoSize

Best Answer

Make sure that you have enabled UnsafeUserParameters in Zabbix Agent config file.

https://www.zabbix.com/documentation/current/manual/appendix/config/zabbix_agentd