Skip to content

Import/Export

export_configuration

export_configuration [OPTIONS]

Export Zabbix configuration for one or more components.

Uses defaults from Zabbix-CLI configuration file if not specified.

NOTE: --name arguments are globs, not regex patterns.

Filename scheme is as follows:

DIRECTORY/OBJECT_TYPE/NAME_ID_[timestamp].FORMAT

But it can be changed to the legacy scheme with --legacy-filenames:

DIRECTORY/OBJECT_TYPE/zabbix_export_OBJECT_TYPE_NAME_ID_[timestamp].FORMAT

Timestamps are disabled by default, but can be enabled with the app.export_timestamps configuration option.

Shows detailed information about exported files in JSON output mode.

Examples

Export everything

export_configuration

Export all host groups

export_configuration --type host_groups

Export all host groups containing 'Linux'

export_configuration --type host_groups --name '*Linux*'

Export all template groups and templates containing 'Linux' or 'Windows'

export_configuration --type template_groups --type templates --name '*Linux*,*Windows*'

Options

--directory <DIRECTORY>
Directory to export configuration to. Overrides directory in config.
Type: text

--type <TYPES,[TYPES...]>
Type(s) of objects to export. Can be specified multiple times. Defaults to all object types.
Separate multiple values with commas, or use --type multiple times.
Type: choice
Choices: host_groups, template_groups, hosts, images, maps, templates, mediaTypes
Default: []

--name <NAMES>
Name(s) of objects to export. Comma-separated list.
Type: text

--format <FORMAT>
Format to export to. Overrides export format in config.
Type: choice
Choices: xml, json, yaml, php

--pretty
Pretty-print output. Not supported for XML.
Type: boolean (flag)
Default: False

--open
Open export directory in file explorer after exporting.
Type: boolean (flag)
Default: False

--ignore-errors
Enable best-effort exporting. Print errors but continue exporting.
Type: boolean (flag)
Default: False


import_configuration

import_configuration <TO_IMPORT> [OPTIONS]

Import Zabbix configuration from file, directory or glob pattern.

Imports all files in all subdirectories if a directory is specified. Uses default export directory if no argument is specified.

Determines format to import based on file extensions.

Arguments

TO_IMPORT
Path to file or directory to import configuration from. Accepts glob pattern. Uses default export directory if not specified.
Type: text

Options

--dryrun
Preview files to import.
Type: boolean (flag)
Default: False

--create-missing/--no-create-missing
Create missing objects.
Type: boolean (flag)
Default: True

--update-existing/--no-update-existing
Update existing objects.
Type: boolean (flag)
Default: True

--delete-missing/--no-delete-missing
Delete missing objects.
Type: boolean (flag)
Default: False

--ignore-errors
Enable best-effort importing. Print errors from failed imports but continue importing.
Type: boolean (flag)
Default: False