Zabbix api method configuration.import requires template uuid tag with template rule createMissing = $true and updateExisting = $false

XMLWordPrintable

    • Type: Problem report
    • Resolution: Unresolved
    • Priority: Trivial
    • None
    • Affects Version/s: None
    • Component/s: API (A)
    • None

      After upgrade of zabbix to version 7.0.18 zabix API method configuration.import requires template uuid 

      for exmaple powershell import code :

      $XML_CONTENT = Get-Content 'D:\tmp\Application-CTS(TESTONLY).xml' -Raw

      $templateBody2 = @{
          jsonrpc = "2.0"
          method = "configuration.import"
          params = @{
              format = "xml"
              source = "$XML_CONTENT"
              rules = @{
                  templates = @{
                          createMissing = $true
                          updateExisting = $false
                  }
                  template_groups= @

      {                     createMissing = $true                     updateExisting = $true             }

              }
          }
          auth = $authToken
          id = 3
      }

      tried several times with different source - you can see attachement in xml

       

       

      The problem is that when i try to create a template in zabbix with this method  configuration.import i dont know the template uuid because it does not exist in zabbix yet. To be be sure that is really unique it must be generated by zabbix itself. 

      when used empty tag:

      <zabbix_export><version>7.0</version><template_groups><template_group><uuid>9d3f3b947f624df18edb18714790f642</uuid><name>RB_Application/Applications_from_cmdb</name></template_group></template_groups><templates><template><uuid></uuid><template>CMDB_Application - CTS - Pre-SIT</template>...

      api error: -32602 Invalid params. Invalid parameter "/1/uuid": cannot be empty.

       

      when used without uuid tag for template: 

      <zabbix_export><version>7.0</version><template_groups><template_group><uuid>9d3f3b947f624df18edb18714790f642</uuid><name>RB_Application/Applications_from_cmdb</name></template_group></template_groups><templates><template><template>CMDB_Application - CTS - Pre-SIT</template>...

      api error : -32500 Application error. Invalid tag "/zabbix_export/templates/template(1)": the tag "uuid" is missing.

       

      I think that it is ok to require template uuid when updateExisting = $true is used only.

      Zabbix cant require teplate uuid when we want just to create a new templete, because the uuid does not exist and zabbix must provide it itself.

       

      Until these day we have been working with zabbix version 5.0.x  where there was nothing like uuid needed like this source was working all right:

       

      <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<zabbix_export><version>5.0</version><date>2025-04-29T10:25:11Z</date><groups><group><name>RB_Application/Applications_from_cmdb</name></group></groups><templates><template><template>CMDB_Application - Ansible - Production</template><name></name><groups><group><name>RB_Application/Applications_from_cmdb</name></group></groups><macros><macro><macro>{$CI_KEY}</macro><value>ITSM-11399235</value><description>Application / Service CI KEY</description></macro><macro><macro>{$CI_NAME}</macro><value>Ansible (Production)</value><description>Application / Service CI NAME</description></macro><macro><macro>{$ENV}</macro><value>Production</value><description>Environment</description></macro><macro><macro>{$L2APP_KEY}</macro><value>KS-11444502</value><description>L2 Support CI KEY (APP)</description></macro><macro><macro>{$L2APP_NAME}</macro><value>RBCZ-JC-P-unix-admins</value><description>L2 Support CI NAME (APP)</description></macro></macros></template></templates></zabbix_export>

       

      When the template has already been in zabbix the api tried to import changes. When the template did not exist it was created by the api call.

       

      Thank you very much

      Robert Landa

       

            Assignee:
            Zabbix Support Team
            Reporter:
            RBCZ Monitoring admins
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: