3 Hosts

Overview

Hosts are exported with many related objects and object relations.

Host export contains:

  • linked host groups
  • host data
  • template linkage
  • host group linkage
  • host interfaces
  • directly linked applications
  • directly linked items
  • directly linked triggers
  • directly linked graphs
  • directly linked discovery rules with all prototypes
  • directly linked web scenarios
  • host macros
  • host inventory data
  • value maps

Exporting

To export hosts, do the following:

  • Go to: ConfigurationHosts
  • Mark the checkboxes of the hosts to export
  • Click on Export below the list

Selected hosts are exported to a local XML file with default name zbx_export_hosts.xml.

Importing

To import hosts, do the following:

  • Go to: ConfigurationHosts
  • Click on Import to the right
  • Select the import file
  • Mark the required options in import rules
  • Click on Import

Note that before Zabbix 4.0.16, when a host is imported and updated, it can only be linked to additional templates and never be unlinked from any.

A success or failure message of the import will be displayed in the frontend.

Import rules:

Rule Description
Update existing Existing elements will be updated with data taken from the import file. Otherwise they will not be updated.
Create new The import will add new elements using data from the import file. Otherwise it will not add them.
Delete missing The import will remove existing elements not present in the import file. Otherwise it will not remove them.
If Delete missing is marked for template linkage (only available since 4.0.16), existing template linkage not present in the import file will be removed from the host along with all entities inherited from the potentially unlinked templates (items, triggers, etc).

Export format

<?xml version="1.0" encoding="UTF-8"?>
       <zabbix_export>
           <version>4.0</version>
           <date>2018-04-03T08:11:42Z</date>
           <groups>
               <group>
                   <name>Zabbix servers</name>
               </group>
           </groups>
           <hosts>
               <host>
                   <host>Export host</host>
                   <name>Export host</name>
                   <description/>
                   <proxy/>
                   <status>0</status>
                   <ipmi_authtype>-1</ipmi_authtype>
                   <ipmi_privilege>2</ipmi_privilege>
                   <ipmi_username/>
                   <ipmi_password/>
                   <tls_connect>1</tls_connect>
                   <tls_accept>1</tls_accept>
                   <tls_issuer/>
                   <tls_subject/>
                   <tls_psk_identity/>
                   <tls_psk/>
                   <templates/>
                   <groups>
                       <group>
                           <name>Zabbix servers</name>
                       </group>
                   </groups>
                   <interfaces>
                       <interface>
                           <default>1</default>
                           <type>1</type>
                           <useip>1</useip>
                           <ip>127.0.0.1</ip>
                           <dns/>
                           <port>10050</port>
                           <bulk>1</bulk>
                           <interface_ref>if1</interface_ref>
                       </interface>
                   </interfaces>
                   <applications>
                       <application>
                           <name>Application</name>
                       </application>
                   </applications>
                   <items>
                       <item>
                           <name>Item</name>
                           <type>0</type>
                           <snmp_community/>
                           <snmp_oid/>
                           <key>item.key</key>
                           <delay>30s</delay>
                           <history>90d</history>
                           <trends>365d</trends>
                           <status>0</status>
                           <value_type>3</value_type>
                           <allowed_hosts/>
                           <units/>
                           <snmpv3_contextname/>
                           <snmpv3_securityname/>
                           <snmpv3_securitylevel>0</snmpv3_securitylevel>
                           <snmpv3_authprotocol>0</snmpv3_authprotocol>
                           <snmpv3_authpassphrase/>
                           <snmpv3_privprotocol>0</snmpv3_privprotocol>
                           <snmpv3_privpassphrase/>
                           <params/>
                           <ipmi_sensor/>
                           <authtype>0</authtype>
                           <username/>
                           <password/>
                           <publickey/>
                           <privatekey/>
                           <port/>
                           <description/>
                           <inventory_link>0</inventory_link>
                           <applications>
                               <application>
                                   <name>Application</name>
                               </application>
                           </applications>
                           <valuemap>
                               <name>Host status</name>
                           </valuemap>
                           <logtimefmt/>
                           <preprocessing/>
                           <interface_ref>if1</interface_ref>
                           <jmx_endpoint/>
                           <master_item/>
                           <timeout>3s</timeout>
                           <url/>
                           <query_fields/>
                           <posts/>
                           <status_codes>200</status_codes>
                           <follow_redirects>1</follow_redirects>
                           <post_type>0</post_type>
                           <http_proxy/>
                           <headers/>
                           <retrieve_mode>0</retrieve_mode>
                           <request_method>1</request_method>
                           <output_format>0</output_format>
                           <allow_traps>0</allow_traps>
                           <ssl_cert_file/>
                           <ssl_key_file/>
                           <ssl_key_password/>
                           <verify_peer>0</verify_peer>
                           <verify_host>0</verify_host>
                       </item>
                   </items>
                   <discovery_rules/>
                   <httptests/>
                   <macros/>
                   <inventory/>
               </host>
           </hosts>
           <triggers>
               <trigger>
                   <expression>{Export host:item.key.last()}<>0</expression>
                   <recovery_mode>0</recovery_mode>
                   <recovery_expression/>
                   <correlation_mode>0</correlation_mode>
                   <correlation_tag/>
                   <name>Item value not 0</name>
                   <url/>
                   <status>0</status>
                   <priority>2</priority>
                   <description/>
                   <type>0</type>
                   <manual_close>0</manual_close>
                   <dependencies/>
                   <tags/>
               </trigger>
           </triggers>
           <graphs>
               <graph>
                   <name>Example graph</name>
                   <width>900</width>
                   <height>200</height>
                   <yaxismin>0.0000</yaxismin>
                   <yaxismax>100.0000</yaxismax>
                   <show_work_period>1</show_work_period>
                   <show_triggers>1</show_triggers>
                   <type>0</type>
                   <show_legend>1</show_legend>
                   <show_3d>0</show_3d>
                   <percent_left>0.0000</percent_left>
                   <percent_right>0.0000</percent_right>
                   <ymin_type_1>0</ymin_type_1>
                   <ymax_type_1>0</ymax_type_1>
                   <ymin_item_1>0</ymin_item_1>
                   <ymax_item_1>0</ymax_item_1>
                   <graph_items>
                       <graph_item>
                           <sortorder>0</sortorder>
                           <drawtype>0</drawtype>
                           <color>1A7C11</color>
                           <yaxisside>0</yaxisside>
                           <calc_fnc>2</calc_fnc>
                           <type>0</type>
                           <item>
                               <host>Export host</host>
                               <key>item.key</key>
                           </item>
                       </graph_item>
                   </graph_items>
               </graph>
           </graphs>
           <value_maps>
               <value_map>
                   <name>Host status</name>
                   <mappings>
                       <mapping>
                           <value>0</value>
                           <newvalue>Up</newvalue>
                       </mapping>
                       <mapping>
                           <value>2</value>
                           <newvalue>Unreachable</newvalue>
                       </mapping>
                   </mappings>
               </value_map>
           </value_maps>
       </zabbix_export>

Element tags

Element tag values are explained in the table below.

Host tags
Element Element property Type Range Description
groups Root element for groups.
group Individual group.
name string Unique group name.
hosts Root element for hosts.
host Individual host.
host string Unique host name.
name string Visible host name.
description text Host description.
status integer 0 - monitored
1 - not monitored
Host status.
ipmi_authtype integer -1 - default
0 - none
1 - MD2
2 - MD5
4 - straight
5 - OEM
6 - RMCP+
IPMI session authentication type.
ipmi_privilege integer 1 - callback
2 - user
3 - operator
4 - admin
5 - OEM
IPMI session privilege level.
ipmi_username string Username for IPMI checks.
ipmi_password string Password for IPMI checks.
tls_connect integer 1 - unencrypted
2 - TLS with PSK
4 - TLS with certificate
Type of outgoing connection.
tls_accept integer 1 - unencrypted
2 - TLS with PSK
3 - unencrypted and TLS with PSK
4 - TLS with certificate
5 - unencrypted and TLS with certificate
6 - TLS with PSK or certificate
7 - unencrypted and TLS with PSK or certificate
Type of incoming connection.
tls_issuer string Allowed agent/proxy certificate issuer.
tls_subject string Allowed agent/proxy certificate subject.
tls_psk_indentity string PSK identity string.
tls_psk string PSK value string.
proxy Proxy.
name string Name of the proxy (if any) that monitors the host.
templates Root element for linked templates.
template Individual template.
name string Template name.
interfaces Root element for host interfaces.
interface Individual interface.
default integer 0 - secondary
1 - primary (default)
Interface status.
Only one primary interface of one type can be on a host.
type integer 0 - unknown
1 - Zabbix agent
2 - SNMP
3 - IPMI
4 - JMX
Interface type.
useip integer 0 - use DNS name
1 - use IP address
Interface to use for connecting to the host.
ip string IP address, can be either IPv4 or IPv6.
dns string DNS name.
port string Port number.
bulk integer 0 - disable
1 - enable
Use bulk requests for SNMP.
interface_ref string Interface reference name to be used in items.
applications Root element for applications.
application Individual application.
name Application name.
macros Root element for macros.
macro Individual macro.
name User macro name.
value User macro value.
Host item tags
Element Element property Type Range Description
items Root element for items.
item Individual item.
name string Item name.
type integer 0 - Zabbix agent
1 - SNMPv1 agent
2 - Zabbix trapper
3 - simple check
4 - SNMPv2 agent
5 - internal
6 - SNMPv3 agent
7 - Zabbix agent (active)
8 - aggregate
9 - HTTP test (web monitoring scenario step)
10 - external
11 - database monitor
12 - IPMI agent
13 - SSH agent
14 - Telnet agent
15 - calculated
16 - JMX agent
17 - SNMP trap
18 - Dependent item
19 - HTTP agent item
Item type.
snmp_community string SNMP community name if 'type' is 1,4.
snmp_oid string SNMP object ID.
key string Item key.
delay string Update interval of the item. Seconds, time unit with suffix, custom intervals or user macros.

Note that delay will be always '0' for trapper items.
history string A time unit of how long the history data should be stored. Time unit with suffix or user macro.
trends string A time unit of how long the trends data should be stored. Time unit with suffix or user macro.
status integer 0 - enabled
1 - disabled
Item status.
value_type integer 0 - float
1 - character
2 - log
3 - unsigned integer
4 - text
Received value type.
allowed_hosts string List of IP addresses (comma delimited) of hosts allowed sending data for the item if 'type' is 2 or 19.
units string Units of returned values (bps, B).
snmpv3_contextname string SNMPv3 context name.
snmpv3_securityname string SNMPv3 security name.
snmpv3_securitylevel integer 0 - noAuthNoPriv
1 - authNoPriv
2 - authPriv
SNMPv3 security level.
snmpv3_authprotocol integer 0 - MD5
1 - SHA
SNMPv3 authentication protocol.
snmpv3_authpassphrase string SNMPv3 authentication passphrase.
snmpv3_privprotocol integer 0 - DES
1 - AES
SNMPv3 privacy protocol.
snmpv3_privpassphrase string SNMPv3 privacy passphrase.
params text Name of the "Executed script" if 'type' is 13,14
"SQL query" field if 'type' is 11
"Formula" field if 'type' is 15.
ipmi_sensor string IPMI sensor ID if 'type' is 12.
authtype integer Authentication type for SSH agent items:
0 - password
1 - key

Authentication type for HTTP agent items:
0 - none
1 - basic
2 - NTLM
Authentication type if 'type' is 13 or 19.
username string User name if 'type' is 11,13,14,19.
password string Password if 'type' is 11,13,14,19.
publickey string Name of the public key file if 'type' is 13.
privatekey string Name of the private key file if 'type' is 13.
port string Custom port for the item.
description text Item description.
inventory_link integer 0 - no link
number - number of field in the 'host_inventory' table
Use item value to populate this inventory field.
logtimefmt string Format of the time in log entries. Used only by log items.
interface_ref string Reference to host interface.
jmx_endpoint string JMX endpoint if 'type' is 16.
url string URL string if 'type' is 19.
allow_traps integer 0 - Do not allow trapping.
1 - Allow trapping.
Property to allow to send data to item if 'type' is 19.
follow_redirects integer 0 - Do not follow redirects.
1 - Follow redirects.
Follow HTTP redirects if 'type' is 19.
headers object Object with HTTP(S) request headers if 'type' is 19.
http_proxy string HTTP(S) proxy connection string if 'type' is 19.
output_format integer 0 - Store as is.
1 - Convert to JSON.
How to process response if 'type' is 19.
post_type integer 0 - Raw data.
2 - JSON data.
3 - XML data.
Type of request body if 'type' is 19.
posts text Request body if 'type' is 19.
query_fields array Array of objects for request query fields if 'type' is 19.
request_method integer 0 - GET
1 - POST
2 - PUT
3 - HEAD
Request method if 'type' is 19.
retrieve_mode integer 0 - Body.
1 - Headers.
2 - Both body and headers will be stored.
What part of response should be stored if 'type' is 19.
ssl_cert_file string Public SSL Key file path if 'type' is 19.
ssl_key_file string Private SSL Key file path if 'type' is 19.
ssl_key_password string Password for SSL Key file if 'type' is 19.
status_codes string Ranges of required HTTP status codes separated by commas if 'type' is 19.
timeout string Item data polling request timeout if 'type' is 19.
verify_host integer 0 - Do not validate.
1 - Validate.
Validate host name in URL is in Common Name field or a Subject Alternate Name field of host certificate if 'type' is 19.
verify_peer integer 0 - Do not validate.
1 - Validate.
Validate is host certificate authentic if 'type' is 19.
value map Value map.
name string Name of the value map to use for the item.
applications Root element for applications.
application Individual application.
name Application name.
preprocessing Item value preprocessing.
step Individual item value preprocessing step.
type integer 1 - custom multiplier
2 - right trim
3 - left trim
4 - trim from both sides
5 - regular expression matching
6 - boolean to decimal
7 - octal to decimal
8 - hexadecimal to decimal
9 - simple change; calculated as (received value-previous value)
10 - change per second; calculated as (received value-previous value)/(time now-time of last check)
11 - XML Path
12 - JSONPath
Type of the item value preprocessing step.
params string Parameters of the item value preprocessing step.
master_item Individual item master item data.
key string Dependent item master item key value.
Host low-level discovery rule tags
Element Element property Type Range Description
discovery_rules Root element for low-level discovery rules.
discovery_rule Individual low-level discovery rule.
For most of the element tag values, see element tag values for a regular item. Only the tags that are specific to low-level discovery rules, are described below.
lifetime string Time period after which items that are no longer discovered will be deleted. Seconds, time unit with suffix or user macro.
filter Individual filter.
evaltype integer 0 - And/or logic
1 - And logic
2 - Or logic
3 - custom formula
Logic to use for checking low-level discovery rule filter conditions.
formula string Custom calculation formula for filter conditions.
conditions Root element for filter conditions.
condition Individual filter condition.
macro string Low-level discovery macro name.
value string Filter value: regular expression or global regular expression.
operator integer
formulaid character Filter condition ID. Used in the custom calculation formula.
item_prototypes Root element for item_prototypes.
item_prototype Individual item_prototype.
For most of the element tag values, see element tag values for a regular item. Only the tags that are specific to item_prototypes, are described below.
application_prototypes Root element for application prototypes.
application_prototype Individual application prototype.
name Application prototype name.
master_item Individual item prototype master item/item prototype data.
key string Dependent item prototype master item/item prototype key value.
Host trigger tags
Element Element property Type Range Description
triggers Root element for triggers.
trigger Individual trigger.
expression string Trigger expression.
recovery_mode integer 0 - expression
1 - recovery expression
2 - none
Basis for generating OK events.
recovery_expression string Trigger recovery expression.
name string Trigger name.
correlation_mode integer 0 - no event correlation
1 - event correlation by tag
Correlation mode.
correlation_tag string The tag name to be used for event correlation.
url string Trigger URL.
status integer 0 - enabled
1 - disabled
Trigger status.
priority integer 0 - not classified
1 - information
2 - warning
3 - average
4 - high
5 - disaster
Trigger severity.
description text Trigger description.
type integer 0 - single problem event
1 - multiple problem events
Event generation type.
manual_close integer 0 - not allowed
1 - allowed
Manual closing of problem events.
dependencies Root element for dependencies.
dependency Individual dependency.
name string Dependency trigger name.
expression string Dependency trigger expression.
recovery_expression string Dependency trigger recovery expression.
tags Root element for event tags.
tag Individual event tag.
tag string Tag name.
value string Tag value.
Host graph tags
Element Element property Type Range Description
graphs Root element for graphs.
graph Individual graph.
name string Graph name.
width integer Graph width, in pixels. Used for preview and for pie/exploded graphs.
height integer Graph height, in pixels. Used for preview and for pie/exploded graphs.
yaxismin double Value of Y axis minimum if 'ymin_type_1' is 1.
yaxismax double Value of Y axis maximum if 'ymax_type_1' is 1.
show_work_period integer 0 - no
1 - yes
Highlight non-working hours if 'type' is 0,1.
show_triggers integer 0 - no
1 - yes
Display simple trigger values as a line if 'type' is 0,1.
type integer 0 - normal
1 - stacked
2 - pie
3 - exploded
4 - 3D pie
5 - 3D exploded
Graph type.
show_legend integer 0 - no
1 - yes
Display graph legend.
show_3d integer 0 - 2D
1 - 3D
Enable 3D style if 'type' is 2,3.
percent_left double Show the percentile line for left axis if 'type' is 0.
percent_right double Show the percentile line for right axis if 'type' is 0.
ymin_type_1 integer 0 - calculated
1 - fixed
2 - last value of the selected item
Minimum value of Y axis if 'type' is 0,1.
ymax_type_1 integer 0 - calculated
1 - fixed
2 - last value of the selected item
Maximum value of Y axis if 'type' is 0,1.
ymin_item_1 string null or item details Item details if 'ymin_type_1' is 2.
ymax_item_1 string null or item details Item details if 'ymax_type_1' is 2.
graph_items Root element for graph items.
graph_item Individual graph item.
sortorder integer Draw order. The smaller value is drawn first. Can be used to draw lines or regions behind (or in front of) another.
drawtype integer 0 - single line
1 - filled region
2 - bold line
3 - dotted line
4 - dashed line
Draw style if graph 'type' is 0.
color string Element color (6 symbols, hex).
yaxisside integer 0 - left axis
1 - right axis
Y axis position (left or right) the element belongs to if graph 'type' is 0,1.
calc_fnc integer 1 - minimum
2 - average
4 - maximum
7 - all (minimum, average and maximum, if graph 'type' is 0)
9 - last (if graph 'type' is not 0,1)
Data to draw if more than one value exists for an item.
type integer 1 - value of the item is represented proportionally on the pie
2 - value of the item represents the whole pie (graph sum)
Draw type for pie/exploded graphs.
item Individual item.
host string Item host.
key string Item key.
Host web scenario tags
Element Element property Type Range Description
httptests Root element for web scenarios.
httptest Individual web scenario.
name string Web scenario name.
delay string Frequency of executing the web scenario. Seconds, time unit with suffix or user macro.
attempts integer 1-10 The number of attempts for executing web scenario steps.
agent string Client agent. Zabbix will pretend to be the selected browser. This is useful when a website returns different content for different browsers.
http_proxy string Specify an HTTP proxy to use, using the format: http://[username[:password]@]proxy.example.com[:port]
variables text List of scenario-level variables (macros) that may be used in scenario steps.
headers text HTTP headers that will be sent when performing a request.
status integer 0 - enabled
1 - disabled
Web scenario status.
authentication integer 0 - none
1 - basic
2 - NTLM
Authentication method.
http_user string Authentication user name.
http_password string Authentication password for specified user name.
verify_peer integer 0 - no
1 - yes
Verify the SSL certificate of the web server.
verify_host integer 0 - no
1 - yes
Verify that the Common Name field or the Subject Alternate Name field of the web server certificate matches.
ssl_cert_file string Name of the SSL certificate file used for client authentication.
ssl_key_file string Name of the SSL private key file used for client authentication.
ssl_key_password string SSL private key file password.
steps Root element for web scenario steps.
step Individual web scenario step.
name string Web scenario step name.
url string URL for monitoring.
posts text List of 'Post' variables.
variables text List of step-level variables (macros) that should be applied after this step.

If the variable value has a 'regex:' prefix, then its value is extracted from the data returned by this step according to the regular expression pattern following the 'regex:' prefix
headers text HTTP headers that will be sent when performing a request.
follow_redirects integer 0 - no
1 - yes
Follow HTTP redirects.
retrieve_mode integer 0 - content
1 - headers only
HTTP response retrieve mode.
timeout string Timeout of step execution. Seconds, time unit with suffix or user macro.
required string Required string. Ignored if empty.
status_codes string A comma delimited list of accepted status codes. Ignored if empty. For example: 200-201,210-299