Zabbix Documentation 4.0

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


Sidebar

manual:xml_export_import:hosts

This is an old revision of the document!


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

When a host is imported and updated, it can only be linked to additional templates and never be unlinked from any.

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 zabbix_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

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

Import rules:

RuleDescription
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.

Export format

<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
    <version>3.4</version>
    <date>2016-12-20T08:26:43Z</date>
    <hosts>
        <host>
            <host>Zabbix server</host>
            <name>Zabbix server</name>
            <description>Zabbix monitoring server.</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>20001</port>
                    <bulk>1</bulk>
                    <interface_ref>if1</interface_ref>
                </interface>
            </interfaces>
            <applications>
                <application>
                    <name>Memory</name>
                </application>
                <application>
                    <name>Zabbix agent</name>
                </application>
            </applications>
            <items>
                <item>
                    <name>Agent ping</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>agent.ping</key>
                    <delay>1m</delay>
                    <history>1w</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>The agent always returns 1 for this item. It could be used in combination with nodata() for availability check.</description>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Zabbix agent</name>
                        </application>
                    </applications>
                    <valuemap>
                        <name>Zabbix agent ping status</name>
                    </valuemap>
                    <logtimefmt/>
                    <preprocessing/>
                    <interface_ref>if1</interface_ref>
                </item>
                <item>
                    <name>Available memory</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>vm.memory.size[available]</key>
                    <delay>1m</delay>
                    <history>1w</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units>B</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>Available memory is defined as free+cached+buffers memory.</description>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Memory</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <interface_ref>if1</interface_ref>
                </item>
            </items>
            <discovery_rules>
                <discovery_rule>
                    <name>Mounted filesystem discovery</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>vfs.fs.discovery</key>
                    <delay>1h</delay>
                    <status>0</status>
                    <allowed_hosts/>
                    <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/>
                    <filter>
                        <evaltype>0</evaltype>
                        <formula/>
                        <conditions>
                            <condition>
                                <macro>{#FSTYPE}</macro>
                                <value>@File systems for discovery</value>
                                <operator>8</operator>
                                <formulaid>A</formulaid>
                            </condition>
                        </conditions>
                    </filter>
                    <lifetime>30d</lifetime>
                    <description>Discovery of file systems of different types as defined in global regular expression &quot;File systems for discovery&quot;.</description>
                    <item_prototypes>
                        <item_prototype>
                            <name>Free disk space on $1</name>
                            <type>0</type>
                            <snmp_community/>
                            <snmp_oid/>
                            <key>vfs.fs.size[{#FSNAME},free]</key>
                            <delay>1m</delay>
                            <history>1w</history>
                            <trends>365d</trends>
                            <status>0</status>
                            <value_type>3</value_type>
                            <allowed_hosts/>
                            <units>B</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>Filesystems</name>
                                </application>
                            </applications>
                            <valuemap/>
                            <logtimefmt/>
                            <preprocessing/>
                            <application_prototypes>
                                <application_prototype>
                                    <name>{#FSNAME}</name>
                                </application_prototype>
                            </application_prototypes>
                            <interface_ref>if1</interface_ref>
                        </item_prototype>
                    </item_prototypes>
                    <trigger_prototypes>
                        <trigger_prototype>
                            <expression>{Zabbix server 2:vfs.fs.size[{#FSNAME},pfree].last()}&lt;20</expression>
                            <recovery_mode>0</recovery_mode>
                            <recovery_expression/>
                            <name>Free disk space is less than 20% on volume {#FSNAME}</name>
                            <correlation_mode>0</correlation_mode>
                            <correlation_tag/>
                            <url/>
                            <status>0</status>
                            <priority>2</priority>
                            <description/>
                            <type>0</type>
                            <manual_close>0</manual_close>
                            <dependencies/>
                            <tags/>
                        </trigger_prototype>
                    </trigger_prototypes>
                    <graph_prototypes>
                        <graph_prototype>
                            <name>Disk space usage {#FSNAME}</name>
                            <width>600</width>
                            <height>340</height>
                            <yaxismin>0.0000</yaxismin>
                            <yaxismax>0.0000</yaxismax>
                            <show_work_period>0</show_work_period>
                            <show_triggers>0</show_triggers>
                            <type>2</type>
                            <show_legend>1</show_legend>
                            <show_3d>1</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>C80000</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>2</type>
                                    <item>
                                        <host>Zabbix server 2</host>
                                        <key>vfs.fs.size[{#FSNAME},total]</key>
                                    </item>
                                </graph_item>
                                <graph_item>
                                    <sortorder>1</sortorder>
                                    <drawtype>0</drawtype>
                                    <color>00C800</color>
                                    <yaxisside>0</yaxisside>
                                    <calc_fnc>2</calc_fnc>
                                    <type>0</type>
                                    <item>
                                        <host>Zabbix server 2</host>
                                        <key>vfs.fs.size[{#FSNAME},free]</key>
                                    </item>
                                </graph_item>
                            </graph_items>
                        </graph_prototype>
                    </graph_prototypes>
                    <host_prototypes/>
                    <interface_ref>if1</interface_ref>
                </discovery_rule>
            </discovery_rules>
            <httptests>
                <httptest>
                    <name>Zabbix</name>
                    <application/>
                    <delay>1m</delay>
                    <attempts>1</attempts>
                    <agent>Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0)</agent>
                    <http_proxy/>
                    <variables/>
                    <headers/>
                    <status>0</status>
                    <authentication>0</authentication>
                    <http_user/>
                    <http_password/>
                    <verify_peer>0</verify_peer>
                    <verify_host>0</verify_host>
                    <ssl_cert_file/>
                    <ssl_key_file/>
                    <ssl_key_password/>
                    <steps>
                        <step>
                            <name>Main page</name>
                            <url>https://zabbix.com</url>
                            <posts/>
                            <variables/>
                            <headers/>
                            <follow_redirects>1</follow_redirects>
                            <retrieve_mode>0</retrieve_mode>
                            <timeout>1m</timeout>
                            <required/>
                            <status_codes>200</status_codes>
                        </step>
                    </steps>
                </httptest>
            </httptests>
            <macros>
                <macro>
                    <macro>{$M1}</macro>
                    <value>m1</value>
                </macro>
                <macro>
                    <macro>{$M2}</macro>
                    <value>m2</value>
                </macro>
            </macros>
            <inventory/>
        </host>
    </hosts>
    <value_maps>
        <value_map>
            <name>Zabbix agent ping status</name>
            <mappings>
                <mapping>
                    <value>1</value>
                    <newvalue>Up</newvalue>
                </mapping>
            </mappings>
        </value_map>
    </value_maps>
</zabbix_export>

Element tags

Element tag values are explained in the table below.

Host tags
ElementElement propertyTypeRangeDescription
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
ElementElement propertyTypeRangeDescription
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
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.
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.
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 0 - password
1 - key
Authentication type if 'type' is 13.
username string User name if 'type' is 11,13,14.
password string Password if 'type' is 11,13,14.
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.
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)
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
ElementElement propertyTypeRangeDescription
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 prototype Individual item prototype master item prototype data.
key string Dependent item prototype master item prototype key value.
Host trigger tags
ElementElement propertyTypeRangeDescription
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
ElementElement propertyTypeRangeDescription
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 colour (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
ElementElement propertyTypeRangeDescription
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.mycompany.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