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

Discovery rule "external check" does not work if item parameter is a macro

XMLWordPrintable

      When creating a discovery rule inside a template with type "external check" and using a macro like

      {HOST.IP} as a parameter to pass to the specified script in the key, zabbix fails to match the returned JSON.
      Example:
      key is: script.name[{HOST.IP}

      ,param1,param2]

      Template is assigned to host with IP 198.18.0.123.

      zabbix_server.log (Debug:4) says:

      11507:20120302:191438.614 In substitute_key_macros() data:'script.name[

      {HOST.IP},param1,param2]'
      11504:20120302:191438.614 End of get_values():0
      11507:20120302:191438.614 In substitute_simple_macros() data:'{HOST.IP}

      '

      11507:20120302:191438.614 End substitute_simple_macros() data:'198.18.0.123'
      11504:20120302:191438.614 In DCconfig_get_poller_nextcheck() poller_type:0
      11507:20120302:191438.614 End of substitute_key_macros():SUCCEED data:'script.name[198.18.0.123,param1,param2]'
      11504:20120302:191438.614 End of DCconfig_get_poller_nextcheck():1330712079
      11507:20120302:191438.614 In get_value() key:'script.name[

      {HOST.IP},param1,param2]'
      11504:20120302:191438.614 sleeping for 1 seconds
      11507:20120302:191438.614 In get_value_external() key:'script.name[{HOST.IP}

      ,param1,param2]'
      11505:20120302:191438.615 get_snmp() snmp_synch_response():0
      11507:20120302:191438.615 In zbx_popen() command:'/opt/zabbix/share/zabbix/externalscripts/script.name "198.18.0.123" "param1" "param2"'

      11507:20120302:191438.705 query [txnlev:1] [begin;]
      11507:20120302:191438.705 query [txnlev:1] [update items set lastclock=1330712078,lastns=704097134,error='Cannot find the "script.name[

      {HOST.IP},param1,param2]" key in received JSON object' where itemid=22508]
      11507:20120302:191438.705 query [txnlev:1] [commit;]
      11507:20120302:191438.708 End of DBlld_process_discovery_rule()

      Zabbix expects the script to return a JSON object with object name "script.name[{HOST.IP}

      ,param1,param2]" where the script would return "script.name[198.18.0.123,param1,param2]".

      That makes macros unusable as a parameter to the script. The script would never know what macro was supplied, just the value of the macro.

      I believe this is a bug.

      1. zabbix_server -V
        Zabbix server v1.9.10 (revision 25576) (01 February 2012)
        Compilation time: Feb 24 2012 10:47:31

      Kind regards,
      simon

            Unassigned Unassigned
            skr Simon Kowallik
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: