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

Zabbix LLD rule produces non-expanding application prototypes, when particular macro not present in JSON data set



      Steps to reproduce:

      1. Suppose we want to discover item with variable amount of application prototypes
      2. So our JSON data can be as follows:
      3. {data:[{"{#HOST}":"aaa.contoso.com","{#GROUP_1}":"Linux Servers"},{"{#HOST}":"bbb.contoso.com","{#GROUP_1}":"Linux Servers","{#GROUP_2}":"Zabbix Servers"}]}

        So each JSON data set can have multiple different GROUP macros.

      4. Then we create item prototype. Set "Host{#HOST}" for item name and add application prototypes: {#GROUP_1}, {#GROUP_2}, .... {#GROUP_5}
      5. When discovery rule fires, it generates item prototype: Host["aaa.contoso.com"] and in applications field macros are exapanded to:
      6. Linux Servers
      7. {#GROUP_1}
      8. {#GROUP_2}
      9. {#GROUP_3}
      10. {#GROUP_4}
      11. {#GROUP_5}

      And for item prototype: Host["bbb.contoso.com"] in applications field macros are expanded to:

      1. Linux Servers
      2. Zabbix Servers
      3. {#GROUP_2}
      4. {#GROUP_3}
      5. {#GROUP_4}
      6. {#GROUP_5}

      Non-present macros for application prototypes should not be just placed there, because it's a macro. So the expected behavior is that Zabbix should not generate wrong and incorrect applications for missing macros.

      I know, this helps troubleshooting, so that it will be visible to zabbix administrator, that some macro did not expand and something might be missing, but this would be better made another way.

      The requirement is to make discovery with variable application prototype amount. 

      If I specify only one application prototype, for example like "{#GROUP}" and then send discovery JSON in two parts, then application prototype just gets overwritten.

      Also, there is no "filter" option for Item Prototype, which would help in this case as I could simply create 5 items, where 1st item looks for {#GROUP_1} macro non-empty, 2nd looks for {#GROUP_1} and {#GROUP_2} macros non empty and last 5-th item would check if JSON data set has all 5 group macros present.



      See screenshot...
      See log file...
      See memory dump...
      See screenshot....
      See attached patch file...




            • Assignee:
              zalex_ua Oleksiy Zagorskyi
              vaku Vadims Kurmis
            • Votes:
              0 Vote for this issue
              4 Start watching this issue


              • Created: