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

LLD incorrectly associates Trigger Prototypes to a single Discovery Rule when there are similar Expressions

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 6.0.11
    • Templates (T)
    • None

      Overview:

      For the purpose on wanting to Tag Discovered Triggers differently from one another (since this is not supported per https://support.zabbix.com/browse/ZBXNEXT-4919), I have attempted to create separate Templates containing similar LLD rules but applying different Macro Filters, example using Systemd LLD Templates. In this example, I am creating a one Template to discover "Linux OS" related services, and a seperate Template to discover "Zabbix" related services, so that their Trigger Prototypes can be tagged differently from one another. I am also modifying the associated Macros and Filters to be unique for each of these templates to not cause any collision.

      Steps to reproduce:{}

      1. Full Clone "Systemd by Zabbix agent 2" into two new Templates - "Systemd by Zabbix agent - linux os" and "Systemd by Zabbix agent - zabbix services"
      2. Update the two new Templates Macros names, example:
        1. Zabbix Services - {$SYSTEMD.NAME.SERVICE.MATCHES.ZABBIX}
        2. Zabbix OS - {$SYSTEMD.NAME.SERVICE.MATCHES.ZABBIXOS}
      1. Populate the Macros with unique sets of systemd services you want to target for the given Template, examples
        1. Zabbix Services - {$SYSTEMD.NAME.SERVICE.MATCHES.ZABBIX} = ^(zabbix-server|zabbix-web-service|zabbix-proxy|httpd|php-fpm)
        2. Zabbix OS - {$SYSTEMD.NAME.SERVICE.MATCHES.ZABBIXOS} = ^(snmpd|snmptrapd)
      2. Update Discovery Rule Filters to leverage these new Macro Names, examples:
        1. Zabbix services - {#UNIT.NAME} matches {$SYSTEMD.NAME.SERVICE.MATCHES.ZABBIX}
        2. Zabbix OS - {#UNIT.NAME} matches {$SYSTEMD.NAME.SERVICE.MATCHES.ZABBIXOS}
      1. Optionally update Trigger Prototype Names to help indicate the source Template of a discovered Trigger. (This should not be required, but done to better show discovery results in examples.)
      2. Apply these unique Templates to a single Host, containing unique Macros and unique Discovery Filter rulesets.

      Result:

      Applying these two distinct templates to a single host, the bug I suspect is that parsing Zabbix does is linking both sets of trigger prototypes to only one of the Discovery rules.

      Notice “Trigger prototypes = 4” is picked up by “zabbix os” Discovery, but “Trigger prototypes = empty (zero/none)” for “zabbix services” Discovery. Both should be “Trigger prototypes = 2”.

      When you click the “Trigger prototypes = 4” button, you see the distinction in name, indicating they come from different Templates, but the Link confirms it is a single Discovery rule from a single Templates picking up all Trigger prototypes from different templates:

      The final confirmation is the Triggers which are created – those matching the filters applied to “zabbix os” Template (snmpd|snmptrapd).

      Although the unique names are picked up, the filtering comes only from the incorrectly associated discovery rule – which effectively creates duplicate triggers.

      Expected:

      The expectation is for Trigger Prototypes to be associated to the correct Discovery Rule that is associated to the same Template from which they were derived. Then, Discovery Rule Filters would apply correctly, and Tagging could be done correctly to the appropriate Template LLD Trigger Prototypes to propagate down to Discovered Triggers.

      Alternatively the ability to tag Discovered Triggers (https://support.zabbix.com/browse/ZBXNEXT-4919) would mitigate the need to duplicate Templates altogether - albeit serving the caveat that Clearing and Rediscovering Triggers would effectively destroy those Tags.

        1. bug-1-3.png
          bug-1-3.png
          12 kB
        2. bug-2-3.png
          bug-2-3.png
          41 kB
        3. bug-3-1.png
          bug-3-1.png
          24 kB
        4. template-systemd-zabbix-os.json
          29 kB
        5. template-systemd-zabbix-services.json
          29 kB

            bmickiewicz Bartosz Mickiewicz
            malvis Matt Alvis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: