Zabbix agent configuration for Windows monitoring¶
Zabbix agents on Windows can be configured to execute custom monitoring scripts, such as PowerShell commands, to track specific application states or services that are not covered by standard metrics^[600-developer__operation-maintenance__zabbix__zabbix-key.md].
PowerShell Execution Policy¶
By default, Windows may prevent the execution of PowerShell scripts, resulting in a "file cannot be loaded because scripts are disabled on this system" error^[600-developer__operation-maintenance__zabbix__zabbix-key.md]. To allow the Zabbix agent to run custom scripts, the execution policy must be set^[600-developer__operation-maintenance__zabbix__zabbix-key.md].
This requires opening PowerShell with administrator privileges and running the following command^[600-developer__operation-maintenance__zabbix__zabbix-key.md]:
Set-ExecutionPolicy RemoteSigned
UserParameter Configuration¶
To monitor custom logic (e.g., checking if a specific JVM or process is running), you must define a UserParameter in the Zabbix agent configuration file^[600-developer__operation-maintenance__zabbix__zabbix-key.md].
Enabling Unsafe Parameters¶
Standard UserParameters restrict certain characters in arguments. If your script requires complex arguments or if you want to pass arguments directly, you should enable UnsafeUserParameters^[600-developer__operation-maintenance__zabbix__zabbix-key.md].
Configuration Syntax¶
The following configuration snippet demonstrates how to enable remote commands, allow unsafe parameters, and define a key that passes arguments to a PowerShell script^[600-developer__operation-maintenance__zabbix__zabbix-key.md]:
EnableRemoteCommands=1
UnsafeUserParameters=1
UserParameter=mypay.robot[*],C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File C:\Zabbix\robot.ps1 $1 $2 $3 $4 $5 $6 $7 $8 $9
Troubleshooting Timeout Issues¶
When executing complex PowerShell scripts or JVM diagnostics via Zabbix, the operation might exceed the default timeout period^[600-developer__operation-maintenance__zabbix__zabbix-key.md]. If the zabbix_get command returns ZBX_NOTSUPPORTED: Timeout while executing a shell script, you need to adjust the Timeout setting in the Zabbix agent configuration file^[600-developer__operation-maintenance__zabbix__zabbix-key.md].
For example, to increase the timeout to 30 seconds^[600-developer__operation-maintenance__zabbix__zabbix-key.md]:
Timeout=30
Related Concepts¶
- [[Zabbix]]
- [[PowerShell]]
Sources¶
^[600-developer__operation-maintenance__zabbix__zabbix-key.md]