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

Import & handling of templates which contain trigger expressions referencing another template items is broken

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Won't fix
    • Icon: Major Major
    • None
    • 1.8.13
    • Frontend (F)

      When you have a template with trigger expression referencing another template items, frontend doesn't handle this properly. Hell breaks loose when trying to import said templates and hosts they have been assigned to, and when editing the trigger expressions referencing another templates items.

      Illustration:
      1. Import Templates: zbx_templates_export.xml; Templates Test Group is created.
      2. Add a new trigger to Test Group / Test Template Master template:

      {Test Template Master:net.tcp.port[,80].last(0)}=0 & {Test Template Slave 1:net.tcp.port[,1080].last(0)}=0 & {Test Template Slave 2:net.tcp.port[,3128].last(0)}=0

      3. Import Hosts: zbx_hosts_export.xml (A set of 5 test hosts linked with previously imported templates). During import, lots of error messages are shown:

      Added new application "Host 1:Test Application Master"
      Added new item "Host 1:net.tcp.port[,80]"
      Missing key "net.tcp.port[,1080]" for host "Host 1"
      Added new application "Host 1:Application Slave 1"
      Added new item "Host 1:net.tcp.port[,1080]"
      Added new trigger "Host 1:TCP Service Slave 1"
      Missing key "net.tcp.port[,3128]" for host "Host 1"
      Added new application "Host 1:Application Slave 2"
      Added new item "Host 1:net.tcp.port[,3128]"
      Added new trigger "Host 1:TCP Service Slave 2"
      Added new trigger "Host 1:Master"
      Item "Host 1:net.tcp.port[,1080]" updated
      Item "Host 1:net.tcp.port[,3128]" updated
      Item "Host 1:net.tcp.port[,80]" updated
      Trigger "Host 1:TCP Service Slave 1" updated
      Trigger "Host 1:TCP Service Slave 2" updated
      Added new trigger "Host 1:TCP Service Master+Slaves"
      Added new application "Host 2:Test Application Master"
      Added new item "Host 2:net.tcp.port[,80]"
      Missing key "net.tcp.port[,1080]" for host "Host 2"
      Added new application "Host 2:Application Slave 1"
      Added new item "Host 2:net.tcp.port[,1080]"
      Added new trigger "Host 2:TCP Service Slave 1"
      Missing key "net.tcp.port[,3128]" for host "Host 2"
      Added new application "Host 2:Application Slave 2"
      Added new item "Host 2:net.tcp.port[,3128]"
      Added new trigger "Host 2:TCP Service Slave 2"
      Added new trigger "Host 2:Master"
      Item "Host 2:net.tcp.port[,1080]" updated
      Item "Host 2:net.tcp.port[,3128]" updated
      Item "Host 2:net.tcp.port[,80]" updated
      Trigger "Host 2:TCP Service Slave 1" updated
      Trigger "Host 2:TCP Service Slave 2" updated
      Added new trigger "Host 2:TCP Service Master+Slaves"
      Added new application "Host 3:Test Application Master"
      Added new item "Host 3:net.tcp.port[,80]"
      Missing key "net.tcp.port[,1080]" for host "Host 3"
      Added new application "Host 3:Application Slave 1"
      Added new item "Host 3:net.tcp.port[,1080]"
      Added new trigger "Host 3:TCP Service Slave 1"
      Missing key "net.tcp.port[,3128]" for host "Host 3"
      Added new application "Host 3:Application Slave 2"
      Added new item "Host 3:net.tcp.port[,3128]"
      Added new trigger "Host 3:TCP Service Slave 2"
      Added new trigger "Host 3:Master"
      Item "Host 3:net.tcp.port[,1080]" updated
      Item "Host 3:net.tcp.port[,3128]" updated
      Item "Host 3:net.tcp.port[,80]" updated
      Trigger "Host 3:TCP Service Slave 1" updated
      Trigger "Host 3:TCP Service Slave 2" updated
      Added new trigger "Host 3:TCP Service Master+Slaves"
      Added new application "Host 4:Test Application Master"
      Added new item "Host 4:net.tcp.port[,80]"
      Missing key "net.tcp.port[,1080]" for host "Host 4"
      Added new application "Host 4:Application Slave 1"
      Added new item "Host 4:net.tcp.port[,1080]"
      Added new trigger "Host 4:TCP Service Slave 1"
      Missing key "net.tcp.port[,3128]" for host "Host 4"
      Added new application "Host 4:Application Slave 2"
      Added new item "Host 4:net.tcp.port[,3128]"
      Added new trigger "Host 4:TCP Service Slave 2"
      Added new trigger "Host 4:Master"
      Item "Host 4:net.tcp.port[,1080]" updated
      Item "Host 4:net.tcp.port[,3128]" updated
      Item "Host 4:net.tcp.port[,80]" updated
      Trigger "Host 4:TCP Service Slave 1" updated
      Trigger "Host 4:TCP Service Slave 2" updated
      Added new trigger "Host 4:TCP Service Master+Slaves"
      Added new application "Host 5:Test Application Master"
      Added new item "Host 5:net.tcp.port[,80]"
      Missing key "net.tcp.port[,1080]" for host "Host 5"
      Added new application "Host 5:Application Slave 1"
      Added new item "Host 5:net.tcp.port[,1080]"
      Added new trigger "Host 5:TCP Service Slave 1"
      Missing key "net.tcp.port[,3128]" for host "Host 5"
      Added new application "Host 5:Application Slave 2"
      Added new item "Host 5:net.tcp.port[,3128]"
      Added new trigger "Host 5:TCP Service Slave 2"
      Added new trigger "Host 5:Master"
      Item "Host 5:net.tcp.port[,1080]" updated
      Item "Host 5:net.tcp.port[,3128]" updated
      Item "Host 5:net.tcp.port[,80]" updated
      Trigger "Host 5:TCP Service Slave 1" updated
      Trigger "Host 5:TCP Service Slave 2" updated
      Added new trigger "Host 5:TCP Service Master+Slaves"
      Trigger "Host 1:TCP Service Master+Slaves" updated
      Trigger "Host 2:TCP Service Master+Slaves" updated
      Trigger "Host 3:TCP Service Master+Slaves" updated
      Trigger "Host 4:TCP Service Master+Slaves" updated
      Trigger "Host 5:TCP Service Master+Slaves" updated
      

      End result is frightening: each host now has 6 triggers, and half of them are buggy: borken-triggers.png

      Now, if you go to Templates configuration and try to edit and save the trigger which has been created in step 2, you again get an impressive list of errors:
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Trigger "Test Template Master:Master" updated
      

      When you Unlink & Clear templates in question from Test hosts and link them back, the problem remains the same.

      If you delete every imported bit and recreate test templates/hosts in the same fashion from scratch, things will look a bit better (no more broken triggers in hosts), but when you edit & save the trigger expression referencing another templates, you still get errors:

      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously.
      Trigger "Test Template Master:Test" updated
      

      If frontend hasn't been designed to handle trigger expressions with references to another templates items, saving such expressions must at the very least be disabled so user doesn't shoot himself in the leg.
      Personally I think this approach should work and therefore it's good if it is getting fixed sometime.

            Unassigned Unassigned
            alix alix
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: