Zabbix template export and import¶
Zabbix templates can be migrated between different instances or backed up by exporting them to an XML file and importing them into the target system^[600-developer-operation-maintenance-zabbix-zabbix-key.md].
XML Export Format¶
Templates are exported as XML files containing the complete definition of the monitoring configuration^[600-developer-operation-maintenance-zabbix-zabbix-key.md]. The root element of this file is <zabbix_export>, which encloses all the specific template data^[600-developer-operation-maintenance-zabbix-zabbix-key.md].
Key metadata included in the export header identifies the format version and the time of creation^[600-developer-operation-maintenance-zabbix-zabbix-key.md]:
- Version: The Zabbix version number compatible with the export file (e.g.,
<version>3.4</version>).^[600-developer-operation-maintenance-zabbix-zabbix-key.md] - Date: The timestamp indicating when the export was generated^[600-developer-operation-maintenance-zabbix-zabbix-key.md].
Template Structure¶
The content within the XML file is organized into several major sections that define the template's behavior and presentation^[600-developer-operation-maintenance-zabbix-zabbix-key.md].
Groups¶
Templates are categorized into host groups to organize the monitored infrastructure^[600-developer-operation-maintenance-zabbix-zabbix-key.md]. For example, a template can be assigned to a group named "MYPAY-Windows"^[600-developer-operation-maintenance-zabbix-zabbix-key.md].
Template Definition¶
The <template> section defines the core identity and scope of the template^[600-developer-operation-maintenance-zabbix-zabbix-key.md]. This includes:
- Template Name: The internal technical name (e.g.,
mypay-robot).^[600-developer-operation-maintenance-zabbix-zabbix-key.md] - Display Name: A human-readable label (e.g.,
MYPAY-ROBOT).^[600-developer-operation-maintenance-zabbix-zabbix-key.md] - Description: A text field explaining the template's purpose, such as "固碼機器人模版" (Fixed-code robot template).^[600-developer-operation-maintenance-zabbix-zabbix-key.md]
Items and Applications¶
The functional monitoring logic is defined by Items, which are specific Metrics to be collected^[600-developer-operation-maintenance-zabbix-zabbix-key.md]. These items are often grouped into Applications for logical organization within the Zabbix frontend^[600-developer-operation-maintenance-zabbix-zabbix-key.md].
A typical item definition includes:
* Name: The label for the metric (e.g., "固碼機器人監控").^[600-developer-operation-maintenance-zabbix-zabbix-key.md]
* Key: The unique identifier for the metric, often accepting parameters (e.g., mypay.robot[robot1047]).^[600-developer-operation-maintenance-zabbix-zabbix-key.md]
* Type: The data collection method (e.g., 0 for Zabbix Agent).^[600-developer-operation-maintenance-zabbix-zabbix-key.md]
* Intervals: Settings for how often data is collected (delay) and how long it is stored (history, trends).^[600-developer-operation-maintenance-zabbix-zabbix-key.md]
* Data Type: The format of the value being collected (value_type), such as a numeric integer.^[600-developer-operation-maintenance-zabbix-zabbix-key.md]
Graphs¶
The export also includes definitions for Graphs, which visualize the data collected by the items^[600-developer-operation-maintenance-zabbix-zabbix-key.md]. The XML specifies dimensions (width, height) and links specific items to the graph to render the visualizations^[600-developer-operation-maintenance-zabbix-zabbix-key.md].
Related Concepts¶
- [[Zabbix UserParameters]]
- [[Zabbix agent]]
Sources¶
^[600-developer-operation-maintenance-zabbix-zabbix-key.md]