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

Import of template containing web scenario creates implicit items in wrong format

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 3.4.7
    • Frontend (F), Server (S)
    • None
    • Ubuntu 16, all updates installed, Zabbix Server + Zabbix Web 3.4.7, MySQL backend.

      Importing a template that contains a web scenario creates items with keys containing single quotes (can be seen in database and in the drop down list when creating triggers at template level). Now, when you assign this template to a host, these implicit items will be created WITHOUT the single quotes on the host, which causes the assignment to fail because the trigger's item key is not existing at the host level.

      Steps to reproduce:
      Import the attached template into a fresh installation of Zabbix. It's a simple template just containing one plain web scenario "Google Webcheck" with just one step inside.

      Verify resulting item entries in database:
      select h.name, i.itemid, i.name, i.key_ from items i, hosts h where key_ like '%web.test%' and i.hostid = h.hostid;
      see attached screenshot 1: in the items table, entries with keys containing single quotes are being created.

      Assign the template to a new host "Webmonitor TEST".

      Re-Check database and see the same items from the template are now also existing on the host, but NOT containing the single quotes. See attached screenshot 2 for the results.

      Try to create a trigger on the TEMPLATE level. When selecting the item to be used by the trigger, you get the list of items containing single quotes. See screenshot 3. The complete trigger expression would look like shown in screenshot 4.

      This fails with the error message shown in screenshot 5:

      Incorrect item key "web.test.fail['Google Webcheck']" provided for trigger expression on "Webmonitor TEST"

      This says it all! The item with the key web.test.fail['Google Webcheck'] (the one containing quotes) does not exist for the host, as at the host level this very same item is added WITHOUT quotes.

      We have discovered this behaviour when we tried to recover an accidently deleted template from a backup. Importing the template itself failed, as it contained web scenarios AND triggers, and the template was assigned to hosts already (trying to override existing template with an import).

      A workaround is to import the template without triggers, change the keys of the items automatically created for the template after template import not to contain the single quotes, then importing the template again, but only the trigger part.

        1. 1_template_items_with_quotes.png
          149 kB
          Christian Anton
        2. 2_differing_item_keys.png
          227 kB
          Christian Anton
        3. 3_select_item_key_at_trigger_creation.png
          838 kB
          Christian Anton
        4. 4_before_adding_trigger.png
          168 kB
          Christian Anton
        5. 5_error_message.png
          104 kB
          Christian Anton
        6. Template_Webcheck_TEST.xml
          2 kB
          Christian Anton

            Unassigned Unassigned
            christiananton Christian Anton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: