File: configuration.md

package info (click to toggle)
zabbix-cli 3.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,860 kB
  • sloc: python: 18,557; makefile: 3
file content (128 lines) | stat: -rw-r--r-- 2,740 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Configuration

!!! note "Configuration file directory"
    The application uses the [platformdirs](https://pypi.org/project/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:

{% include ".includes/config-locations.md" %}

<!-- TODO: Gather the different paths in CI, then combine them to construct the config-locations.md file -->

## 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:

```bash
zabbix-cli init
```

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`:

```bash
zabbix-cli init --url https://zabbix.example.com --user Admin
```

To overwrite an existing configuration file, use the `--overwrite` option:

```
zabbix-cli init --overwrite
```

## Config directory

The default configuration directory can be opened in the system's file manager with the `open` command:

```bash
zabbix-cli open config
```

To print the path instead of opening it, use the `--path` option:

```bash
zabbix-cli open config --path
```

## Show config

The contents of the current configuration file can be displayed with `show_config`:

```bash
zabbix-cli 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:

```
zabbix-cli sample_config > /path/to/config.toml
```

A more convoluted way of creating a default config file in the default location would be:

```
zabbix-cli sample_config > "$(zabbix-cli open --path config)/zabbix-cli.toml"
```

The created config looks like this:

```toml
{% include "data/sample_config.toml" %}
```

## Options

{% macro render_option(option) %}
{% if option.is_model %}

### `{{ option.name }}`

{{ option.description }}

{% for field in option.fields %}
{{ render_option(field) }}
{% endfor %}

{% else %}

#### `{{ option.name }}`

{{ option.description }}

Type: `{{ option.type }}`

{% if option.default %}
Default: `{{ option.default }}`
{% endif %}

{% if option.choices_str %}
Choices: `{{ option.choices_str }}`
{% endif %}

{% if option.required %}
Required: `true`
{% endif %}

{% if option.parents_str and option.example %}
**Example:**

```toml
{{ option.example }}
```

{% endif %}

----

{% endif %}
{% endmacro %}
{% for option in config_options.fields %}
{{ render_option(option) }}
{% endfor %}