-
Problem report
-
Resolution: Cannot Reproduce
-
Trivial
-
None
-
6.4.2, 6.4.3
-
None
After update agent from version 6.2.6 to 6.4.2 userparameters don't work at all on Windows Server 2019 and 2022
Steps to reproduce:
- zabbix_agent2.conf:
Include=C:\zabbix_userparameters\*.conf
mail_queue.conf in C:\zabbix_userparameters\ directory :
UserParameter=mail.queue,powershell.exe -NoProfile -ExecutionPolicy Bypass -file "C:\zabbix_userparameters\scripts\mail_queue.ps1" UserParameter=mail.test1,powershell.exe -NoProfile -ExecutionPolicy Bypass -command "Write-Host ([System.DirectoryServices.ActiveDirectory.ActiveDirectorySite]::GetComputerSite().Name)" UserParameter=mail.test2,echo test2
- Testing keys
.\zabbix_get.exe -s localhost -k mail.queue .\zabbix_get.exe -s localhost -k mail.test1 .\zabbix_get.exe -s localhost -k mail.test2
- Tried to set UserParameterDir to C:\Windows\System32, it works the same
Result:
Output:
PS C:\Program Files\zabbix_agent2\bin> .\zabbix_get.exe -s localhost -k mail.queue ZBX_NOTSUPPORTED: Cannot find path to cmd.exe command: exec: "cmd.exe": cannot run executable found relative to current directory PS C:\Program Files\zabbix_agent2\bin> .\zabbix_get.exe -s localhost -k mail.test1 ZBX_NOTSUPPORTED: Cannot find path to cmd.exe command: exec: "cmd.exe": cannot run executable found relative to current directory PS C:\Program Files\zabbix_agent2\bin> .\zabbix_get.exe -s localhost -k mail.test2 ZBX_NOTSUPPORTED: Cannot find path to cmd.exe command: exec: "cmd.exe": cannot run executable found relative to current directory
Log file:
2023/05/31 16:17:55.702025 received passive check request: 'mail.queue' from '10.*.*.*' 2023/05/31 16:17:55.702602 [1] adding new request for key: 'mail.queue' 2023/05/31 16:17:55.703195 [1] created direct exporter task for plugin 'UserParameter' itemid:0 key 'mail.queue' 2023/05/31 16:17:55.703782 executing direct exporter task for key 'mail.queue' 2023/05/31 16:17:55.704358 [UserParameter] executing command:'powershell.exe -NoProfile -ExecutionPolicy Bypass -file "C:\zabbix_userparameters\scripts\mail_queue.ps1"' 2023/05/31 16:17:55.707300 failed to execute direct exporter task for key 'mail.queue' error: 'Cannot find path to cmd.exe command: exec: "cmd.exe": cannot run executable found relative to current directory' 2023/05/31 16:17:55.707829 sending passive check response: ZBX_NOTSUPPORTED: 'Cannot find path to cmd.exe command: exec: "cmd.exe": cannot run executable found relative to current directory' to '10.*.*.*'
Zabbix Web says the same after trying to test value:
Cannot find path to cmd.exe command: exec: "cmd.exe": cannot run executable found relative to current directory
Expected:
PS C:\Program Files\zabbix_agent2\bin> .\zabbix_get.exe -s localhost -k mail.queue
int number
PS C:\Program Files\zabbix_agent2\bin> .\zabbix_get.exe -s localhost -k mail.test1
string
PS C:\Program Files\zabbix_agent2\bin> .\zabbix_get.exe -s localhost -k mail.test2 test2