Import/Export
export_configuration
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 all host groups
Export all host groups containing 'Linux'
Export all template groups and templates containing 'Linux' or 'Windows'
Options
--directory
<DIRECTORY>
Directory to export configuration to. Overrides directory in config.
Type: directory
--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
Default: False
--open
Open export directory in file explorer after exporting.
Type: boolean
Default: False
--ignore-errors
Enable best-effort exporting. Print errors but continue exporting.
Type: boolean
Default: False
import_configuration
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
Default: False
--create-missing
/--no-create-missing
Create missing objects.
Type: boolean
Default: True
--update-existing
/--no-update-existing
Update existing objects.
Type: boolean
Default: True
--delete-missing
/--no-delete-missing
Delete missing objects.
Type: boolean
Default: False
--ignore-errors
Enable best-effort importing. Print errors from failed imports but continue importing.
Type: boolean
Default: False