Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
docs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
docs
Commits
8d0a3418
Commit
8d0a3418
authored
May 28, 2015
by
Julius Volz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve Configuration / SD documentation.
parent
25e19ac5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
48 deletions
+60
-48
configuration.md
content/docs/operating/configuration.md
+60
-48
No files found.
content/docs/operating/configuration.md
View file @
8d0a3418
...
@@ -15,8 +15,8 @@ load](/docs/querying/rules/#configuring-rules).
...
@@ -15,8 +15,8 @@ load](/docs/querying/rules/#configuring-rules).
To view all available command-line flags, run
`prometheus -h`
.
To view all available command-line flags, run
`prometheus -h`
.
Prometheus can reload its configuration at runtime. If the new configuration
Prometheus can reload its configuration at runtime. If the new configuration
is not well-form
atted
the changes will not be applied.
is not well-form
ed,
the changes will not be applied.
A configuration reload is triggered by sending
`SIGHUP`
to the Prometheus process.
A configuration reload is triggered by sending
a
`SIGHUP`
to the Prometheus process.
This will also reload any configured rule files.
This will also reload any configured rule files.
...
@@ -40,7 +40,7 @@ The other placeholders are specified separately.
...
@@ -40,7 +40,7 @@ The other placeholders are specified separately.
A valid example file can be found
[
here
](
https://github.com/prometheus/prometheus/blob/master/config/testdata/conf.good.yml
)
.
A valid example file can be found
[
here
](
https://github.com/prometheus/prometheus/blob/master/config/testdata/conf.good.yml
)
.
The global configuration specifies parameters valid in all other configuration
The global configuration specifies parameters
that are
valid in all other configuration
contexts. They also serve as defaults for other configuration sections.
contexts. They also serve as defaults for other configuration sections.
...
@@ -71,21 +71,22 @@ scrape_configs:
...
@@ -71,21 +71,22 @@ scrape_configs:
### Scrape configurations `<scrape_config>`
### Scrape configurations `<scrape_config>`
The scrape config specifies a set of targets, which might dynamically change, and
A
`scrape_config`
section specifies a set of targets and parameters describing how
parameters describing how to scrape them.
to scrape them. In the general case, one scrape configuration specifies a single
In the general case one scrape configuration specifies a single job. In advanced
job. In advanced configurations, this may change.
configurations this might change.
Static targets can be configured via the
`target_groups`
parameter. The other
Targets may be statically configured via the
`target_groups`
parameter or
configs allow dynamic target discovery. Additionally, the
`relabel_configs`
allow
dynamically discovered using one of the supported service-discovery mechanisms.
advanced modifications to any target belonging to the scrape config.
Additionally,
`relabel_configs`
allow advanced modifications to any
target and its labels before scraping.
```
```
# The job name assigned to scraped metrics by default.
# The job name assigned to scraped metrics by default.
job_name: <name>
job_name: <name>
# How frequently to scrape targets from this job.
# How frequently to scrape targets from this job.
[ scrape_interval: <duration> | default = <global_config.scrape_interval> ]
[ scrape_interval: <duration> | default = <global_config.scrape_interval> ]
# Per-target timeout when scraping this job.
# Per-target timeout when scraping this job.
[ scrape_timeout: <duration> | default = <global_config.scrape_timeout> ]
[ scrape_timeout: <duration> | default = <global_config.scrape_timeout> ]
...
@@ -94,7 +95,7 @@ job_name: <name>
...
@@ -94,7 +95,7 @@ job_name: <name>
[ metrics_path: <path> | default = /metrics ]
[ metrics_path: <path> | default = /metrics ]
# The URL scheme with which to fetch metrics from targets.
# The URL scheme with which to fetch metrics from targets.
[ scheme: <scheme> | default = http ]
[ scheme: <scheme> | default = http ]
# HTTP basic authentication information.
# HTTP basic authentication information.
basic_auth:
basic_auth:
...
@@ -129,12 +130,12 @@ regex `[a-zA-Z_][a-zA-Z0-9_-]`.
...
@@ -129,12 +130,12 @@ regex `[a-zA-Z_][a-zA-Z0-9_-]`.
### Target groups `<target_group>`
### Target groups `<target_group>`
Target Groups collect a group of targets and specify
a common label set for them.
A
`target_group`
allows specifying a list of targets and
a common label set for them.
They are the canoncial way to specify static targets in a scrape config.
They are the canoncial way to specify static targets in a scrape config
uration
.
```
```
# The targets specified by the target group.
# The targets specified by the target group.
targets:
targets:
[ - '<host>' ]
[ - '<host>' ]
# Labels assigned to all metrics scraped from the targets.
# Labels assigned to all metrics scraped from the targets.
...
@@ -142,43 +143,44 @@ labels:
...
@@ -142,43 +143,44 @@ labels:
[ <labelname>: <labelvalue> ... ]
[ <labelname>: <labelvalue> ... ]
```
```
Where
`<host>`
is a valid string consisting of a hostname or IP followed by a port
Where
`<host>`
is a valid string consisting of a hostname or IP followed by a port
number.
number.
### DNS-SD configurations `<dns_sd_config>`
### DNS-SD configurations `<dns_sd_config>`
A DNS-SD configuration allows to specify a set of hosts for which DNS SRV records are
A DNS-SD configuration allows specifying a set of DNS SRV record names which
queried. The DNS servers to be contacted are read from
`/etc/resolv.conf`
.
are periodically queried to discover a list of targets (host-port pairs). The
DNS servers to be contacted are read from
`/etc/resolv.conf`
.
The label
`__meta_dns_srv_name`
is attached to discovered targets with the queried
During the
[
relabeling phase
](
#relabeling-relabel_config
)
, the meta label
`__meta_dns_srv_name`
is
SRV name as its value.
available on each target and is set to the SRV record name that produced the
discovered target.
```
```
# A list of
host
names to be queried.
# A list of
DNS SRV record
names to be queried.
names:
names:
[ - <
host
> ]
[ - <
record_name
> ]
# The time after which the provided names are refreshed.
# The time after which the provided names are refreshed.
[ refresh_interval: <duration> | default = 30s ]
[ refresh_interval: <duration> | default = 30s ]
```
```
Where
`<host>`
is a valid hostname.
Where
`<record_name>`
is any DNS SRV record name.
### Consul SD configurations `<consul_sd_config>`
### Consul SD configurations `<consul_sd_config>`
Consul SD configurations allow
to retrieve
scrape targets from
[
Consul's
](
https://www.consul.io
)
Consul SD configurations allow
retrieving
scrape targets from
[
Consul's
](
https://www.consul.io
)
Catalog API.
Catalog API.
The following
labels are attached to targets
:
The following
meta labels are available on targets during relabeling
:
*
`__meta_consul_node`
: the node name defined for the target
*
`__meta_consul_node`
: the node name defined for the target
*
`__meta_consul_tags`
: the list of tags of the target joined by the tag separator
*
`__meta_consul_tags`
: the list of tags of the target joined by the tag separator
*
`__meta_consul_service`
: the name of the service the target belongs to
*
`__meta_consul_service`
: the name of the service the target belongs to
*
`__meta_consul_dc`
: the datacenter
string
for the target
*
`__meta_consul_dc`
: the datacenter
name
for the target
```
```
# The information to access the Consul API. It is to be defined
# The information to access the Consul API. It is to be defined
# as the Consul documentation requires.
# as the Consul documentation requires.
server: <host>
server: <host>
...
@@ -192,19 +194,19 @@ server: <host>
...
@@ -192,19 +194,19 @@ server: <host>
services:
services:
[ - <string> ]
[ - <string> ]
# The string by which
c
onsul tags are joined into the tag label.
# The string by which
C
onsul tags are joined into the tag label.
[ tag_separator: <string> | default = , ]
[ tag_separator: <string> | default = , ]
```
```
### File
based SD configurations `<file_sd_config>`
### File
-
based SD configurations `<file_sd_config>`
File
based service discovery provides a more dynam
ic way to configure static targets
File
-based service discovery provides a more gener
ic way to configure static targets
and serves as an interface to plug in custom service discovery mechanisms.
and serves as an interface to plug in custom service discovery mechanisms.
It reads a set of files containing a list of zero or more
`<target_group>`
s. Changes to
It reads a set of files containing a list of zero or more
`<target_group>`
s. Changes to
all defined files are detected via disk watches and applied immediately. Files may be
all defined files are detected via disk watches and applied immediately. Files may be
provided in YAML or JSON format. Only changes resulting in well-form
att
ed target groups
provided in YAML or JSON format. Only changes resulting in well-formed target groups
are applied.
are applied.
The JSON version of a target group has the following format:
The JSON version of a target group has the following format:
...
@@ -218,10 +220,11 @@ The JSON version of a target group has the following format:
...
@@ -218,10 +220,11 @@ The JSON version of a target group has the following format:
}
}
```
```
As a fallback, the file contents are re-read in the specified refresh interval.
As a fallback, the file contents are also re-read periodically at the specified
refresh interval.
Each target has
the
`__meta_filepath`
label attached. Its value is set to the filepath
Each target has
a meta label
`__meta_filepath`
during the
[
relabeling phase
](
#relabeling-relabel_config
)
.
from which the target was extracted.
Its value is set to the filepath
from which the target was extracted.
```
```
# Patterns for files from which target groups are extracted.
# Patterns for files from which target groups are extracted.
...
@@ -239,23 +242,25 @@ may contain a single `*` that matches any character sequence, e.g. `my/path/tg_*
...
@@ -239,23 +242,25 @@ may contain a single `*` that matches any character sequence, e.g. `my/path/tg_*
### Relabeling `<relabel_config>`
### Relabeling `<relabel_config>`
Relabeling is a powerful tool to dynamically rewrite the label set of a target before
Relabeling is a powerful tool to dynamically rewrite the label set of a target before
its gets scraped. Multiple relabeling steps can be configured per scrape config.
it gets scraped. Multiple relabeling steps can be configured per scrape configuration.
They are applied to the label set of each target in order of their configuration.
They are applied to the label set of each target in order of their appearance
in the configuration file.
Initially, aside from the configured labels, the
`job`
label is set to the
`job_name`
value
of the surrounding scrape configuration. The
`__address__`
label is set to the
`<host>:<port>`
Initially, aside from the configured global and per-target labels, a target's
`job`
value of the target.
label is set to the
`job_name`
value of the respective scrape configuration.
After relabeling the
`instance`
label is set to the value of
`__address__`
by default if
The
`__address__`
label is set to the
`<host>:<port>`
address of the target.
After relabeling, the
`instance`
label is set to the value of
`__address__`
by default if
it was not set during relabeling.
it was not set during relabeling.
Additional labels prefixed with
`__meta_`
may be available for relabeling. They are set
Additional labels prefixed with
`__meta_`
may be available during the
by the service discovery mechanism that provided the target and vary between mechanisms.
relabeling phase. They are set by the service discovery mechanism that provided
the target and vary between mechanisms.
Labels starting with
`__`
will be removed from the label set after relabeling is completed.
Labels starting with
`__`
will be removed from the label set after relabeling is completed.
```
```
# The source labels select values from existing labels. Their content is concatenated
# The source labels select values from existing labels. Their content is concatenated
#
by
the configured separator and matched against the configured regular expression.
#
using
the configured separator and matched against the configured regular expression.
source_labels: '[' <labelname> [, ...] ']'
source_labels: '[' <labelname> [, ...] ']'
# Separator placed between concatenated source label values.
# Separator placed between concatenated source label values.
...
@@ -276,5 +281,12 @@ regex: <regex>
...
@@ -276,5 +281,12 @@ regex: <regex>
[ action: <relabel_action> | default = replace ]
[ action: <relabel_action> | default = replace ]
```
```
Where
`<relabel_action> = drop | keep | replace`
and
`<regex>`
is a valid
`<regex>`
is any valid
[
RE2 regular expression
](
https://github.com/google/re2/wiki/Syntax
)
.
regular expression.
`<relabel_action>`
determines the relabeling action to take:
*
`replace`
: Match
`regex`
against the concatenated
`source_labels`
. Then, set
`target_label`
to
`replacement`
, with match group references
(
`${1}`
,
`${2}`
, ...) in
`replacement`
substituted by their value.
*
`keep`
: Drop targets for which
`regex`
does not match the concatenated
`source_labels`
.
*
`drop`
: Drop targets for which
`regex`
matches the concatenated
`source_labels`
.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment