Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-24821

Wrong 'execute_on' value in audit is recorded when executing ipmi, telnet or webhook scripts

XMLWordPrintable

    • 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

      From docs

      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
      

            arimdjonoks Artjoms Rimdjonoks
            arimdjonoks Artjoms Rimdjonoks
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 4h 50m
                4h 50m