API method configuration.import

XMLWordPrintable

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

      `Hi, i wold like to request at least better descryption of configuration.import / host.create api methods in your documentation (using for zabbix 7.0 LTS) 

      We running zabbix 7.0.18 currently

      Try to import host as described in docu via configuration.import :  host.create

      <?xml version="1.0" encoding="UTF-8"?>
      <zabbix_export>
      	<version>7.0</version>
      	<host_groups>
      		<host_group>
      			<name>pam-admins</name>
      			<uuid>2a34af8c66904e86ade124eb3df21b62</uuid>
      		</host_group>
      		<host_group>
      			<name>DC01_Hraskeho</name>
      			<uuid>031b184cff714830a480d9250e8eafdf</uuid>
      		</host_group>
      		<host_group>
      			<name>robert</name>
      			<uuid>d80b43f4834c42b5b9a74e5d9406c058</uuid>
      		</host_group>
      	</host_groups>
      	<hosts>
      		<host>
      			<host>TESTRL</host>
      			<name>TESTRL</name>
      			<description>None</description>
      			<monitored_by>PROXY</monitored_by>
      			<proxy>
      				<name>zabprx1mp9</name>
      			</proxy>
      			<templates>
      				<template>
      					<name>RB_Template_CMDB_empty</name>
      				</template>
      			</templates>
      			<groups>
      				<group>
      					<name>pam-admins</name>
      				</group>
      				<group>
      					<name>DC01_Hraskeho</name>
      				</group>
      				<group>
      					<name>robert</name>
      				</group>
      			</groups>
      			<interfaces>
      				<interface>
      					<type>1</type>
      					<useip>1</useip>
      					<ip>127.0.0.1</ip>
      					<dns></dns>
      					<port>10050</port>
      				</interface>
      				<interface>
      					<type>2</type>
      					<useip>1</useip>
      					<ip>127.0.0.1</ip>
      					<dns></dns>
      					<port>161</port>
      					<details>
      						<version>2</version>
      						<community>public</community>
      					</details>
      				</interface>
      			</interfaces>
      			<tags>
      				<tag>
      					<tag>LOC</tag>
      					<value>DC01_Hraskeho</value>
      				</tag>
      				<tag>
      					<tag>ENV</tag>
      					<value>Production</value>
      				</tag>
      				<tag>
      					<tag>OS</tag>
      					<value>Windows</value>
      				</tag>
      				<tag>
      					<tag>CI_KEY</tag>
      					<value>ITSM-11419919</value>
      				</tag>
      				<tag>
      					<tag>CI_KEY</tag>
      					<value>ITSM-11419921</value>
      				</tag>
      			</tags>
      			<macros>
      				<macro>
      					<macro>{$WHATEVER}</macro>
      					<value>test</value>
      					<description>test</description>
      				</macro>
      				<macro>
      					<macro>{$L2APP}</macro>
      					<value>RBCZ-JC-P-pam-admins</value>
      					<description>Application support</description>
      				</macro>
      				<macro>
      					<macro>{$L2APP_NAME}</macro>
      					<value>RBCZ-JC-P-pam-admins</value>
      					<description>Application support CI NAME</description>
      				</macro>
      				<macro>
      					<macro>{$L2APP_KEY}</macro>
      					<value>KS-11513513</value>
      					<description>Application support CI KEY</description>
      				</macro>
      				<macro>
      					<macro>{$L2SYS}</macro>
      					<value>RBCZ-JC-P-pam-admins</value>
      					<description>System support</description>
      				</macro>
      				<macro>
      					<macro>{$L2SYS_NAME}</macro>
      					<value>RBCZ-JC-P-pam-admins</value>
      					<description>System support CI NAME</description>
      				</macro>
      				<macro>
      					<macro>{$L2SYS_KEY}</macro>
      					<value>KS-11513513</value>
      					<description>System support CI KEY</description>
      				</macro>
      				<macro>
      					<macro>{$CI_KEY}</macro>
      					<value>ITSM-11419919</value>
      					<description>Server CI Key</description>
      				</macro>
      			</macros>
      		</host>
      	</hosts>
      </zabbix_export>
      

      because there is just one example in configuration.,import about importing a new template i have to look further to docu to host.create to find what element should be in configuration.import to succesfully import a new host.

      returns:

      2.0     @{code=-32500; message=Application error.; data=Invalid tag "/zabbix_export/hosts/host(1)/interfaces/interface(1)": unexpected tag "main".}  2

       

       

      2.0     @{code=-32500; message=Application error.; data=Invalid tag "/zabbix_export/hosts/host(1)/interfaces/interface(1)/type": unexpected constant "1".}  2

       

      2.0     @{code=-32500; message=Application error.; data=Invalid tag "/zabbix_export/hosts/host(1)/interfaces/interface(1)/useip": unexpected constant "1".}

       

       

      2.0     @{code=-32500; message=Application error.; data=Invalid tag "/zabbix_export/hosts/host(1)/interfaces/interface(1)": the tag "interface_ref" is missing.} 

       

      -> there is no information in api documentation about this interface tag called ,,interface_ref" - where is it documented? What are possible values? How is the behaviour?

       

      The second thing is that when i make a host export from GUI in the exported XML there are different tags and their values. For example :

      <interfaces><interface><default>YES</default><type>ZABBIX</type><useip>YES</useip><ip>127.0.0.1</ip><dns></dns><port>10050</port><interface_ref>ifZABBIX</interface_ref></interface></interfaces> 

      <default>YES</default> - but in api is decribed as <main> element with possible values 1/0

      <useip>YES</useip>  - in GUI export is value YES / NO (propably) , but in api descryption there are values 1/0

       

      This behaviour is just little frustrating...

      Thank you for your response. RaiffaisenBank CZ admins

       

       

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

              Created:
              Updated: