Configuration
Configuration file directory
The application uses the platformdirs package to determine the configuration directory.
The application is configured with a TOML file. The file is created on startup if it doesn't exist.
The configuration file is searched for in the following locations:
./zabbix-cli.toml$XDG_CONFIG_HOME/zabbix-cli/zabbix-cli.toml$XDG_CONFIG_DIRS/zabbix-cli/zabbix-cli.toml
./zabbix-cli.toml~/Library/Application Support/zabbix-cli/zabbix-cli.toml~/Library/Preferences/zabbix-cli/zabbix-cli.toml
.\zabbix-cli.toml%LOCALAPPDATA%\zabbix-cli\zabbix-cli.toml%APPDATA%\zabbix-cli\zabbix-cli.toml
Create a config
The configuration file is automatically created when the application is started for the first time.
The config file can also manually be created with the init command:
The application will print the location of the created configuration file.
To bootstrap the config with a URL and username, use the options --url and --user:
To overwrite an existing configuration file, use the --overwrite option:
Config directory
The default configuration directory can be opened in the system's file manager with the open command:
To print the path instead of opening it, use the --path option:
Show config
The contents of the current configuration file can be displayed with show_config:
Sample config
A sample configuration file can be printed to the terminal with the sample_config command. This can be redirected to a file to create a configuration file in an arbitrary location:
The created config looks like this (with actual paths instead of placeholders)
[api]
url = "https:/zabbix.example.com"
username = "Admin"
password = ""
auth_token = ""
verify_ssl = true
[app]
use_session_file = true
session_file = "/path/to/data_dir/.zabbix-cli_session.json"
auth_token_file = "/path/to/data_dir/.zabbix-cli_auth_token"
use_auth_file = true
auth_file = "/path/to/data_dir/.zabbix-cli_auth"
allow_insecure_auth_file = true
history = true
history_file = "/path/to/data_dir/history"
bulk_mode = "strict"
legacy_json_format = false
[app.commands.create_host]
create_interface = true
hostgroups = []
[app.commands.create_group]
ro_groups = []
rw_groups = []
[app.commands.create_hostgroup]
ro_groups = []
rw_groups = []
[app.commands.create_templategroup]
ro_groups = []
rw_groups = []
[app.commands.create_user]
usergroups = []
[app.commands.create_notification_user]
usergroups = []
[app.commands.export]
directory = "/path/to/data_dir/exports"
format = "json"
timestamps = false
[app.output]
format = "table"
color = true
paging = false
[logging]
enabled = true
log_level = "INFO"
log_file = "/path/to/logs_dir/zabbix-cli.log"
[plugins]
Options
api
Configuration for the Zabbix API.
url
URL of the Zabbix API host. Should not include /api_jsonrpc.php.
Type: str
Default: https:/zabbix.example.com
Example:
username
Username for the Zabbix API.
Type: str
Default: Admin
Example:
password
Password for user.
Type: str
Example:
auth_token
API auth token.
Type: str
Example:
verify_ssl
Verify SSL certificate of the Zabbix API host. Can also be a path to a CA bundle.
Type: Union | str
Default: true
Example:
timeout
API request timeout in seconds.
Type: Optional
Example:
app
Configuration for app defaults and behavior.
use_session_file
Use session file for storing API session IDs for persistent sessions.
Type: bool
Default: true
Example:
session_file
Path to session file.
Type: str
Default: /path/to/data_dir/.zabbix-cli_session.json
Example:
use_auth_file
Look for user credentials stored in plaintext in auth file.
Type: bool
Default: true
Example:
auth_file
Path to auth file.
Type: str
Default: /path/to/data_dir/.zabbix-cli_auth
Example:
allow_insecure_auth_file
Type: bool
Default: true
Example:
history
Enable command history.
Type: bool
Default: true
Example:
history_file
Path to history file.
Type: str
Default: /path/to/data_dir/history
Example:
bulk_mode
Bulk mode error handling.
Type: str
Default: strict
Choices: strict, continue, skip
Example:
legacy_json_format
Use legacy JSON format.
Type: bool
Default: false
Example:
app.commands
Configuration of commands.
app.commands.create_host
Configuration for the create_host command.
create_interface
Create a DNS/IP interface for the host automatically.
Type: bool
Default: true
Example:
hostgroups
Default host group to add hosts to.
Type: list[str]
Example:
app.commands.create_group
Shared config for create_hostgroup and create_templategroup commands.
Can be used to configure both commands at once. Has no effect if
create_hostgroup or create_templategroup is set.
ro_groups
Default user groups to give read-only permissions to groups when --ro-groups option is not provided.
Type: list[str]
Example:
rw_groups
Default user groups to give read/write permissions to groups when --rw-groups option is not provided.
Type: list[str]
Example:
app.commands.create_hostgroup
Configuration for the create_hostgroup command.
ro_groups
Default user groups to give read-only permissions to groups when --ro-groups option is not provided.
Type: list[str]
Example:
rw_groups
Default user groups to give read/write permissions to groups when --rw-groups option is not provided.
Type: list[str]
Example:
app.commands.create_templategroup
Configuration for the create_templategroup command.
ro_groups
Default user groups to give read-only permissions to groups when --ro-groups option is not provided.
Type: list[str]
Example:
rw_groups
Default user groups to give read/write permissions to groups when --rw-groups option is not provided.
Type: list[str]
Example:
app.commands.create_user
Configuration for the create_user command.
usergroups
Default user groups to add users to when --usergroups is not provided.
Type: list[str]
Example:
app.commands.create_notification_user
Configuration for the create_notification_user command.
usergroups
Default user groups to add notification users to when --usergroups is not provided.
Type: list[str]
Example:
app.commands.export
Shared configuration for export_configuration and import_configuration commands.
directory
Default directory to export files to.
Type: str
Default: /path/to/data_dir/exports
Example:
format
Default export format.
Type: str
Default: json
Choices: xml, json, yaml, php
Example:
timestamps
Include timestamps in exported filenames.
Type: bool
Default: false
Example:
app.output
Configuration for output formatting.
format
Default output format.
Type: str
Default: table
Choices: json, table
Example:
color
Use colors in terminal output.
Type: bool
Default: true
Example:
paging
Use paging in terminal output.
Type: bool
Default: false
Example:
logging
Configuration for application logs.
enabled
Enable logging.
Type: bool
Default: true
Example:
log_level
Log level.
Type: str
Default: INFO
Choices: DEBUG, INFO, WARN, WARNING, ERROR, CRITICAL, FATAL
Example:
log_file
File for storing logs. Can be omitted to log to stderr (warning: NOISY).
Type: str
Default: /path/to/logs_dir/zabbix-cli.log
Example: