-
Problem report
-
Resolution: Fixed
-
Trivial
-
6.0.32rc1, 6.4.17rc1, 7.0.0, 7.2.0alpha1 (master)
-
Sprint candidates
-
0.5
Execute IPMI script on a host.
Resulting audit is:
script.command: echo 55; exit 1; script.error: IPMI command value is not supported [55; exit 1;] script.execute_on: 0 script.hostid: 10670
script.execute_on: is 0
execute_on possible values are:
Possible values: 0 - run on Zabbix agent; 1 - run on Zabbix server. It is supported only if execution of global scripts is enabled on Zabbix server; 2 - (default) run on Zabbix server or proxy.
So, 0 means run on Zabbix agent.
However, this is wrong.
This IPMI script is executed on the server (this is not ipmi agent type item script).
What's, more in DB this execute_on is kept with a value of 2:
zabbix=> select execute_on from scripts where scriptid=15; execute_on ------------ 2
The issue is caused by the code:
if (ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT == script->type) ZBX_STR2UCHAR(script->execute_on, row[6]);
which initialises execute_on only for the ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT, when in fact this value exists for scripts of other types apart from 'CUSTOM_SCRIPT':
#define ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT 0 #define ZBX_SCRIPT_TYPE_IPMI 1 #define ZBX_SCRIPT_TYPE_SSH 2 #define ZBX_SCRIPT_TYPE_TELNET 3 #define ZBX_SCRIPT_TYPE_WEBHOOK 5