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

Adding Template to a Host Via Auto-Registration Rule Initially Fails if the Template Has a Cross Template Trigger Dependency On Another Template Being Added At The Same Time Via Auto-registration

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • None
    • Server (S)
    • None
    • Zabbix Server/Agent Version 6.4.7

      Steps to reproduce:

      1. Create two templates (template A and template B) each with a single item and a trigger. Make template B's trigger dependent on template A's trigger.
      2. Create two separate auto-registration rules to add each of the templates to a host based on an arbitrary string being contained in the host metadata string.
      3. Register the host with Zabbix server

      Result:

      Depending on which auto-registration rule is executed/applied first you may get an error indicating the following:

      cannot link template(s) "Template B" to host "testinghost": trigger "Trigger B" in template "Template B" has dependency from trigger "Trigger A" in template "Template A"

      It seems there may be a race condition where if Template A's trigger hasn't finished being added to the host before it tries to add the host to Template B it fails as the trigger in Template B does not have the required dependent trigger from Template A added on the host.

      Unsure if it's relevant but I found this: https://www.zabbix.com/forum/zabbix-help/41490-how-does-zabbix-execute-actions

      I've checked the auto-registration rule IDs and can confirm Template A in my environment has a numerically lower auto registration rule ID than Template B's auto-registration rule ruling out the fact that lower IDs get applied first.

      Expected:
      I would expect the templates to be added to the host in some sort of discernible order so Template A can be added first before the Zabbix server attempts to add Template B to avoid this race condition entirely.

      Unsure if this could be implemented via ordering the execution based on the alphabetical order of the auto-registration rules or implement some sort of ordered list that can be changed by selecting the auto-registration rule and selecting "Move Up" or "Move Down" to control the order.

      Apologies if I've missed some functionality in Zabbix that this resolves but I've exhausted my research and would like a developer to look at this if possible. I would attempt a fix myself but I am not a C programmer. I think I found the source code here where this fix might be implemented: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/src/zabbix_server/actions.c

      It is worth noting that this is resolved when the auto-registration rule is run again (usually via restarting the agent on the host) but I would rather avoid this if at all possible.

            ksalins Karlis Salins
            eddie.paton Edward Paton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: