-
Incident report
-
Resolution: Duplicate
-
Trivial
-
None
-
None
-
None
-
Windows server 2016 standard 1607, zabbix-agent2
Steps to reproduce:
add to configuration file
UserParameter=zaza[*],powershell write-host "PREVED $1"
Result:
# zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]' ZBX_NOTSUPPORTED: Cannot execute command: exec: "cmd": cannot run executable found relative to current directory
Expected:
# zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]'
PREVED MEDVED
If I start agent2 in foreground(at console) - problem not exists(I get valid responce). Problem exists only when agent2 installed and started as a windows service.
Testing on different agent2 versions with the same configfile on this host. Problem was found at agent2 6.0.13 version and newer:
# zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]' ; zabbix_get -s 10.205.255.213 -k 'agent.version' PREVED MEDVED 6.0.0 # zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]' ; zabbix_get -s 10.205.255.213 -k 'agent.version' PREVED MEDVED 6.0.9 # zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]' ; zabbix_get -s 10.205.255.213 -k 'agent.version' PREVED MEDVED 6.0.11 # zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]' ; zabbix_get -s 10.205.255.213 -k 'agent.version' PREVED MEDVED 6.0.12 # zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]' ; zabbix_get -s 10.205.255.213 -k 'agent.version' ZBX_NOTSUPPORTED: Cannot execute command: exec: "cmd": cannot run executable found relative to current directory 6.0.13 # zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]' ; zabbix_get -s 10.205.255.213 -k 'agent.version' ZBX_NOTSUPPORTED: Cannot execute command: exec: "cmd": cannot run executable found relative to current directory 6.0.17
Full configfile
Server=10.205.255.78,127.0.0.1
ServerActive=10.205.255.78
Hostname=tech-exch01
LogFile=c:\Program Files\Zabbix-Agent2\zabbix_agent2.log
LogFileSize=1
LogType=file
DebugLevel=4
Timeout=20
UnsafeUserParameters=1
Plugins.SystemRun.LogRemoteCommands=1
Plugins.Log.MaxLinesPerSecond=20
UserParameter=zaza[*],powershell write-host "PREVED $1"
log:
2023/05/30 11:15:28.576299 received passive check request: 'zaza[MEDVED]' from '10.205.255.78' 2023/05/30 11:15:28.576299 [1] processing update request (1 requests) 2023/05/30 11:15:28.577288 [1] adding new request for key: 'zaza[MEDVED]' 2023/05/30 11:15:28.577288 [1] created direct exporter task for plugin 'UserParameter' itemid:0 key 'zaza[MEDVED]' 2023/05/30 11:15:28.577288 executing direct exporter task for key 'zaza[MEDVED]' 2023/05/30 11:15:28.577288 [UserParameter] executing command:'powershell write-host "PREVED MEDVED"' 2023/05/30 11:15:28.577288 failed to execute direct exporter task for key 'zaza[MEDVED]' error: 'Cannot execute command: exec: "cmd": cannot run executable found relative to current directory' 2023/05/30 11:15:28.578292 sending passive check response: ZBX_NOTSUPPORTED: 'Cannot execute command: exec: "cmd": cannot run executable found relative to current directory' to '10.205.255.78'