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

Consistent export templates from web interface

XMLWordPrintable

    • Team C
    • Sprint 100 (May 2023), Sprint 101 (Jun 2023), Sprint 102 (Jul 2023), Sprint 103 (Aug 2023)
    • 2

      Please consider changing the behavior of building templates when they are exported from the frontend.

      Right now, exported templates will have a different order of entities that are stored as items of an array in the resulting YAML or XML. If you delete these and recreate them they will have a different order in the resulting file. We assume that the reason behind this behaviour is that during the export these are sorted using their IDs in the DB and if you delete and recreate them, they will have different IDs.

      Examples of such entities:

      • overrides
      • LLD macro paths in discovery rules
      • graphs in dashboards
      • fields in graphs
      • formulas in filters
      • script items' parameters
      • etc.

      Our current template creation tooling implementation uses the logic of deleting everything in the template and recreating it from scratch. As a result, it generates unnecessary diff, which makes it harder to review PRs (actually, a lot harder for some templates with a lot of such entities, or if for some reason you need to rebuild all templates with some minor change).

      Steps to reproduce:

      1. Export a template with lots of overrides, LLD macro paths, etc (for example "Chassis by IPMI", "SMART by Zabbix agent 2", "Cisco Meraki", "Azure by HTTP", ...)
      2. Export it from the frontend and replace it in the main Zabbix repo.
      3. Most likely, you'll already get such diff. But if not, then stage these changes, then make further changes.
      4. As an example for the template "Chassis by IPMI", delete some LLD macros from the "Threshold sensors discovery" rule and create them from scratch.
      5. Export it from the frontend and replace it in the main Zabbix repo again.
      6. Check the unstaged area diff.

      Result:

      Entities are being mixed and change their order. See the attached screenshots with the examples of such diff.

      Expected:

      The exported templates should remain consistent at all times. This may be potentially dangerous, especially in case of filters in the LLD rules as it just randomly changes the macro order (formula IDs, A/B etc.), but I think that we've seen such behaviour only in case of AND type of calculation. Still, it would be much better to have at least alphabetical sort order during the export as it will give at least some kind of consistency.

        1. 2023-04-24_14-08.png
          2023-04-24_14-08.png
          111 kB
        2. 2023-04-24_14-38.png
          2023-04-24_14-38.png
          62 kB
        3. 2023-05-07_15-26.png
          2023-05-07_15-26.png
          60 kB
        4. 2023-05-07_15-28_1.png
          2023-05-07_15-28_1.png
          32 kB
        5. 2023-05-07_15-34.png
          2023-05-07_15-34.png
          111 kB
        6. image-2023-05-23-06-58-09-600.png
          image-2023-05-23-06-58-09-600.png
          21 kB
        7. image-2023-05-23-06-58-56-254.png
          image-2023-05-23-06-58-56-254.png
          23 kB
        8. image-2023-05-23-11-13-22-265.png
          image-2023-05-23-11-13-22-265.png
          9 kB
        9. photo_2023-04-24_14-45-44.jpg
          photo_2023-04-24_14-45-44.jpg
          39 kB
        10. photo_2023-04-24_15-14-05.jpg
          photo_2023-04-24_15-14-05.jpg
          87 kB
        11. screenshot-1.png
          screenshot-1.png
          5 kB
        12. screenshot-2.png
          screenshot-2.png
          5 kB

            jfreibergs Janis Freibergs
            abiba Andrew Biba
            Team C
            Votes:
            2 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: