You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/config.md
+44-22Lines changed: 44 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ The formatting rules for the `ARG` variables are as follows:
15
15
For example, if environment variables `ARG_WEB_ROUTE-PREFIX=/monitor` and `ARG_WEB_EXTERNAL-URL=http://localhost/monitor` are defined, Prometheus will be started with the arguments `web.route-prefix=/monitor` and `web.external-url=http://localhost/monitor`. The result would be Prometheus initialization equivalent to the command that follows.
Environment variables prefixed with `GLOBAL_` are used instead Prometheus global entries in the configuration.
32
+
Environment variables prefixed with `GLOBAL__`, `ALERTING__`, `SCRAPE_CONFIGS__`, `REMOTE_WRITE__`, and `REMOTE_READ__` are used to configure Prometheus.
33
33
34
-
The formatting rules for the `GLOBAL` variables are as follows:
34
+
The formatting rules for these variable are as follows:
35
35
36
-
1. Variable name has to be prefixed with `GLOBAL_`.
37
-
2. Capital letters will be transformed to lower case.
36
+
1. Environment keys will be transformed to lowercase.
37
+
2. Double underscore is used to go one level deeper in a yaml dictionary.
38
+
3. A single underscore followed by a number indicates the position of an array.
38
39
39
-
For example, if environment variable `GLOBAL_SCRAPE_INTERVAL=10s` is defined, the resulting Prometheus configuration would be as follows.
40
+
### Examples
40
41
41
-
```
42
+
The following are examples of using environmental variables to configure Prometheus. Pleaes consult the Prometheus configuration [documentation](https://prometheus.io/docs/prometheus/latest/configuration/configuration) for all configuration options.
43
+
44
+
-`GLOBAL__SCRAPE_INTERVAL=10s`
45
+
46
+
```yaml
42
47
global:
43
48
scrape_interval: 10s
44
49
```
45
50
46
-
Nested values can be specified by separating them with `-`. For example, if environment variables `GLOBAL_EXTERNAL_LABELS-CLUSTER=swarm` and `GLOBAL_EXTERNAL_LABELS-TYPE=production` are defined, the resulting Prometheus configuration would be as follows.
51
+
- `GLOBAL__EXTERNAL_LABELS=cluster=swarm`
47
52
48
-
```
53
+
```yaml
49
54
global:
50
55
external_labels:
51
56
cluster: swarm
52
57
type: production
53
58
```
54
59
60
+
This is *NOT* `GLOBAL__EXTERNAL_LABELS__CLUSTER=swarm` because `CLUSTER` is not a standard Prometheus configuration. The `external_labels` option is a list of key values as shown in their documentation:
It is possible to add servers that are not part of the Docker Swarm Cluster just adding the variables `SCRAPE_PORT` and `SERVICE_NAME` on the environment. The project is going to use the [static_configs](https://prometheus.io/docs/operating/configuration/#<static_config>) configuration.
Please consult [Prometheus Configuration](https://prometheus.io/docs/operating/configuration/) for more information about the available options.
71
105
72
-
## Remote Read Configuration
73
-
74
-
Environment variables prefixed with `REMOTE_READ_` are used instead Prometheus `remote_read` entries in the configuration.
75
-
76
-
The formatting rules for the `REMOTE_READ` variables follow the same pattern as those used for [Global Configuration](#global-configuration)
77
-
78
-
## Remote Write Configuration
79
-
80
-
Environment variables prefixed with `REMOTE_WRITE_` are used instead Prometheus `remote_write` entries in the configuration.
81
-
82
-
The formatting rules for the `REMOTE_WRITE` variables follow the same pattern as those used for [Global Configuration](#global-configuration)
83
-
84
106
## Scrapes
85
107
86
108
Additional scrapes can be added through files prefixed with `scrape_`. By default, all such files located in `/run/secrets` are automatically added to the `scrape_configs` section of the configuration. The directory can be changed by setting a different value to the environment variable `CONFIGS_DIR`.
0 commit comments