This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.

2 Templates

Overview

Templates are exported with many related objects and object relations.

Template export contains:

  • linked host groups
  • template data
  • linkage to other templates
  • linkage to host groups
  • directly linked applications
  • directly linked items
  • directly linked triggers
  • directly linked graphs
  • directly linked screens
  • directly linked discovery rules with all prototypes
  • directly linked web scenarios
  • value maps

Exporting

To export templates, do the following:

  • Go to: ConfigurationTemplates
  • Mark the checkboxes of the templates to export
  • Click on Export below the list

Selected templates are exported to a local XML file with default name zabbix_export_templates.xml.

Importing

To import templates, do the following:

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

When a template 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.

Export format

<?xml version="1.0" encoding="UTF-8"?>
       <zabbix_export>
           <version>4.0</version>
           <date>2018-04-03T06:25:22Z</date>
           <groups>
               <group>
                   <name>Templates/Databases</name>
               </group>
           </groups>
           <templates>
               <template>
                   <template>Template DB MySQL</template>
                   <name>Template DB MySQL</name>
                   <description/>
                   <groups>
                       <group>
                           <name>Templates/Databases</name>
                       </group>
                   </groups>
                   <applications>
                       <application>
                           <name>MySQL</name>
                       </application>
                   </applications>
                   <items>
                       <item>
                           <name>MySQL status</name>
                           <type>0</type>
                           <snmp_community/>
                           <snmp_oid/>
                           <key>mysql.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>It requires user parameter mysql.ping, which is defined in userparameter_mysql.conf.
       
       0 - MySQL server is down
       1 - MySQL server is up</description>
                           <inventory_link>0</inventory_link>
                           <applications>
                               <application>
                                   <name>MySQL</name>
                               </application>
                           </applications>
                           <valuemap>
                               <name>Service state</name>
                           </valuemap>
                           <logtimefmt/>
                           <preprocessing/>
                           <jmx_endpoint/>
                           <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>
                           <master_item/>
                       </item>
                       <item>
                           <name>MySQL begin operations per second</name>
                           <type>0</type>
                           <snmp_community/>
                           <snmp_oid/>
                           <key>mysql.status[Com_begin]</key>
                           <delay>1m</delay>
                           <history>1w</history>
                           <trends>365d</trends>
                           <status>0</status>
                           <value_type>0</value_type>
                           <allowed_hosts/>
                           <units>qps</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>It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf.</description>
                           <inventory_link>0</inventory_link>
                           <applications>
                               <application>
                                   <name>MySQL</name>
                               </application>
                           </applications>
                           <valuemap/>
                           <logtimefmt/>
                           <preprocessing>
                               <step>
                                   <type>10</type>
                                   <params/>
                                   <error_handler>0</error_handler>
                                   <error_handler_params/>
                               </step>
                           </preprocessing>
                           <jmx_endpoint/>
                           <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>
                           <master_item/>
                       </item>
                       <item>
                           <name>MySQL queries per second</name>
                           <type>0</type>
                           <snmp_community/>
                           <snmp_oid/>
                           <key>mysql.status[Questions]</key>
                           <delay>1m</delay>
                           <history>1w</history>
                           <trends>365d</trends>
                           <status>0</status>
                           <value_type>0</value_type>
                           <allowed_hosts/>
                           <units>qps</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>It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf.</description>
                           <inventory_link>0</inventory_link>
                           <applications>
                               <application>
                                   <name>MySQL</name>
                               </application>
                           </applications>
                           <valuemap/>
                           <logtimefmt/>
                           <preprocessing>
                               <step>
                                   <type>10</type>
                                   <params/>
                                   <error_handler>0</error_handler>
                                   <error_handler_params/>
                               </step>
                           </preprocessing>
                           <jmx_endpoint/>
                           <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>
                           <master_item/>
                       </item>
                   </items>
                   <discovery_rules/>
                   <httptests/>
                   <macros/>
                   <templates/>
                   <screens>
                       <screen>
                           <name>MySQL performance</name>
                           <hsize>2</hsize>
                           <vsize>1</vsize>
                           <screen_items>
                               <screen_item>
                                   <resourcetype>0</resourcetype>
                                   <width>500</width>
                                   <height>200</height>
                                   <x>0</x>
                                   <y>0</y>
                                   <colspan>1</colspan>
                                   <rowspan>1</rowspan>
                                   <elements>0</elements>
                                   <valign>1</valign>
                                   <halign>0</halign>
                                   <style>0</style>
                                   <url/>
                                   <dynamic>0</dynamic>
                                   <sort_triggers>0</sort_triggers>
                                   <resource>
                                       <name>MySQL operations</name>
                                       <host>Template DB MySQL</host>
                                   </resource>
                                   <max_columns>3</max_columns>
                                   <application/>
                               </screen_item>
                           </screen_items>
                       </screen>
                   </screens>
               </template>
           </templates>
           <triggers>
               <trigger>
                   <expression>{Template DB MySQL:mysql.ping.last(0)}=0</expression>
                   <recovery_mode>0</recovery_mode>
                   <recovery_expression/>
                   <name>MySQL is down</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>
           </triggers>
           <graphs>
               <graph>
                   <name>MySQL operations</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>C8C800</color>
                           <yaxisside>0</yaxisside>
                           <calc_fnc>2</calc_fnc>
                           <type>0</type>
                           <item>
                               <host>Template DB MySQL</host>
                               <key>mysql.status[Com_begin]</key>
                           </item>
                       </graph_item>
                   </graph_items>
               </graph>
           </graphs>
           <value_maps>
               <value_map>
                   <name>Service state</name>
                   <mappings>
                       <mapping>
                           <value>0</value>
                           <newvalue>Down</newvalue>
                       </mapping>
                       <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.

Template tags
Element Element property Type Range Description
templates Root element for templates.
template Individual template.
template string Unique template name.
name string Visible template name.
description text Template description.
groups Root element for host groups.
group Individual host group.
name string Unique group name.
applications Root element for template applications.
application Individual template application.
name Application name.
macros Root element for template user macros.
macro Individual template user macro.
name User macro name.
value User macro value.
templates Root element for linked templates.
template Individual template.
name string Template name.
Template 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, user macros or LLD macros.
history string A time unit of how long the history data should be stored. Time unit with suffix, user macro or LLD macro.
trends string A time unit of how long the trends data should be stored. Time unit with suffix, user macro or LLD 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.
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 allows 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 XPath
12 - JSONPath
13 - in range
14 - matches regular expression
15 - does not match regular expression
16 - check for error in JSON
17 - check for error in XML
18 - check for error using regular expression
19 - discard unchanged
20 - discard unchanged with heartbeat
21 - JavaScript
Type of the item value preprocessing step.
params string Parameters of the item value preprocessing step.
error_handler integer 0 - error message is set by Zabbix server
1 - discard value
2 - set custom value
3 - set custom error message
Action type used in case of preprocessing step failure.
error_handler_params string Error handler parameters used with 'error_handler'.
master_item Individual item master item data.
key string Dependent item master item key value.
Template 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.
lld_macro_paths Root element for LLD macro paths.
lld_macro_path Individual LLD macro path.
macro string Low-level discovery macro name.
path string Selector for value which will be assigned to corresponding macro.
preprocessing LLD rule value preprocessing.
step Individual LLD rule value preprocessing step.
type integer
5 - regular expression matching
12 - JSONPath
15 - does not match regular expression
16 - check for error in JSON
20 - discard unchanged with heartbeat
Type of the item value preprocessing step.
params string Parameters of the LLD rule value preprocessing step.
error_handler integer 0 - error message is set by Zabbix server
1 - discard value
2 - set custom value
3 - set custom error message
Action type used in case of preprocessing step failure.
error_handler_params string Error handler parameters used with 'error_handler'.
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.
Template 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.
Template 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 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.
Template 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.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