Prometheus scrape
Collect metrics via the Prometheus client
Alias
This component was previously called the prometheus
source. Make sure to update your
Vector configuration to accommodate the name change:
[sources.my_prometheus_scrape_source]
+type = "prometheus_scrape"
-type = "prometheus"
Configuration
Example configurations
{
"sources": {
"my_source_id": {
"type": "prometheus_scrape",
"endpoints": [
"http://localhost:9090/metrics"
]
}
}
}
[sources.my_source_id]
type = "prometheus_scrape"
endpoints = [ "http://localhost:9090/metrics" ]
---
sources:
my_source_id:
type: prometheus_scrape
endpoints:
- http://localhost:9090/metrics
{
"sources": {
"my_source_id": {
"type": "prometheus_scrape",
"endpoints": [
"http://localhost:9090/metrics"
],
"query": {
"match[]": [
"{job=\"somejob\"}",
"{__name__=~\"job:.*\"}"
]
},
"scrape_interval_secs": 15
}
}
}
[sources.my_source_id]
type = "prometheus_scrape"
endpoints = [ "http://localhost:9090/metrics" ]
scrape_interval_secs = 15
[sources.my_source_id.query]
"match[]" = [ "{job=\"somejob\"}", "{__name__=~\"job:.*\"}" ]
---
sources:
my_source_id:
type: prometheus_scrape
endpoints:
- http://localhost:9090/metrics
query:
"match[]":
- '{job="somejob"}'
- '{__name__=~"job:.*"}'
scrape_interval_secs: 15
auth
optional objectConfiguration of the authentication strategy for HTTP requests.
HTTP authentication should be used with HTTPS only, as the authentication credentials are passed as an HTTP header without any additional encryption beyond what is provided by the transport itself.
auth.password
required string literalstrategy = "basic"
auth.strategy
required string literal enumOption | Description |
---|---|
basic | Basic authentication. The username and password are concatenated and encoded via base64. |
bearer | Bearer authentication. The bearer token value (OAuth2, JWT, etc.) is passed as-is. |
endpoint_tag
optional string literalThe tag name added to each event representing the scraped instance’s endpoint.
The tag value is the endpoint of the scraped instance.
endpoints
required [string]honor_labels
optional boolControls how tag conflicts are handled if the scraped source has tags to be added.
If true
, the new tag is not added if the scraped metric has the tag already. If false
, the conflicting tag
is renamed by prepending exported_
to the original name.
This matches Prometheus’ honor_labels
configuration.
false
instance_tag
optional string literalThe tag name added to each event representing the scraped instance’s host:port
.
The tag value is the host and port of the scraped instance.
proxy
optional objectProxy configuration.
Configure to proxy traffic through an HTTP(S) proxy when making external requests.
Similar to common proxy configuration convention, users can set different proxies to use based on the type of traffic being proxied, as well as set specific hosts that should not be proxied.
proxy.http
optional string literalProxy endpoint to use when proxying HTTP traffic.
Must be a valid URI string.
proxy.https
optional string literalProxy endpoint to use when proxying HTTPS traffic.
Must be a valid URI string.
proxy.no_proxy
optional [string]A list of hosts to avoid proxying.
Multiple patterns are allowed:
Pattern | Example match |
---|---|
Domain names | example.com matches requests to example.com |
Wildcard domains | .example.com matches requests to example.com and its subdomains |
IP addresses | 127.0.0.1 matches requests to 127.0.0.1 |
CIDR blocks | 192.168.0.0/16 matches requests to any IP addresses in this range |
Splat | * matches all hosts |
query
optional objectCustom parameters for the scrape request query string.
One or more values for the same parameter key can be provided. The parameters provided in this option are
appended to any parameters manually provided in the endpoints
option. This option is especially useful when
scraping the /federate
endpoint.
query.*
required [string]tls
optional objecttls.alpn_protocols
optional [string]Sets the list of supported ALPN protocols.
Declare the supported ALPN protocols, which are used during negotiation with peer. They are prioritized in the order that they are defined.
tls.ca_file
optional string literalAbsolute path to an additional CA certificate file.
The certificate must be in the DER or PEM (X.509) format. Additionally, the certificate can be provided as an inline string in PEM format.
tls.crt_file
optional string literalAbsolute path to a certificate file used to identify this server.
The certificate must be in DER, PEM (X.509), or PKCS#12 format. Additionally, the certificate can be provided as an inline string in PEM format.
If this is set, and is not a PKCS#12 archive, key_file
must also be set.
tls.key_file
optional string literalAbsolute path to a private key file used to identify this server.
The key must be in DER or PEM (PKCS#8) format. Additionally, the key can be provided as an inline string in PEM format.
tls.key_pass
optional string literalPassphrase used to unlock the encrypted key file.
This has no effect unless key_file
is set.
tls.verify_certificate
optional boolEnables certificate verification.
If enabled, certificates must not be expired and must be issued by a trusted issuer. This verification operates in a hierarchical manner, checking that the leaf certificate (the certificate presented by the client/server) is not only valid, but that the issuer of that certificate is also valid, and so on until the verification process reaches a root certificate.
Relevant for both incoming and outgoing connections.
Do NOT set this to false
unless you understand the risks of not verifying the validity of certificates.
tls.verify_hostname
optional boolEnables hostname verification.
If enabled, the hostname used to connect to the remote host must be present in the TLS certificate presented by the remote host, either as the Common Name or as an entry in the Subject Alternative Name extension.
Only relevant for outgoing connections.
Do NOT set this to false
unless you understand the risks of not verifying the remote hostname.
Environment variables
HTTPS_PROXY
common optional string literalThe global URL to proxy HTTPS requests through.
If another HTTPS proxy is set in the configuration file or at a component level, this one will be overridden.
The lowercase variant has priority over the uppercase one.
HTTP_PROXY
common optional string literalThe global URL to proxy HTTP requests through.
If another HTTP proxy is set in the configuration file or at a component level, this one will be overridden.
The lowercase variant has priority over the uppercase one.
NO_PROXY
common optional string literalList of hosts to avoid proxying globally.
Allowed patterns here include:
Pattern | Example match |
---|---|
Domain names | example.com matches requests to example.com |
Wildcard domains | .example.come matches requests to example.com and its subdomains |
IP addresses | 127.0.0.1 matches requests to 127.0.0.1 |
CIDR blocks | 192.168.0.0./16 matches requests to any IP addresses in this range |
Splat | * matches all hosts |
If another no_proxy
value is set in the configuration file or at a component level, this
one is overridden.
The lowercase variant has priority over the uppercase one.
http_proxy
common optional string literalThe global URL to proxy HTTP requests through.
If another HTTP proxy is set in the configuration file or at a component level, this one will be overridden.
The lowercase variant has priority over the uppercase one.
https_proxy
common optional string literalThe global URL to proxy HTTPS requests through.
If another HTTPS proxy is set in the configuration file or at a component level, this one will be overridden.
The lowercase variant has priority over the uppercase one.
no_proxy
common optional string literalList of hosts to avoid proxying globally.
Allowed patterns here include:
Pattern | Example match |
---|---|
Domain names | example.com matches requests to example.com |
Wildcard domains | .example.come matches requests to example.com and its subdomains |
IP addresses | 127.0.0.1 matches requests to 127.0.0.1 |
CIDR blocks | 192.168.0.0./16 matches requests to any IP addresses in this range |
Splat | * matches all hosts |
If another no_proxy
value is set in the configuration file or at a component level, this
one is overridden.
The lowercase variant has priority over the uppercase one.
Outputs
<component_id>
Output Data
Metrics
counter
counterendpoint_tag
is set.instance_tag
is set.gauge
gaugeendpoint_tag
is set.instance_tag
is set.histogram
gaugeendpoint_tag
is set.instance_tag
is set.summary
gaugeendpoint_tag
is set.instance_tag
is set.Telemetry
Metrics
linkcomponent_discarded_events_total
countercomponent_id
instead. The value is the same as component_id
.component_errors_total
countercomponent_id
instead. The value is the same as component_id
.component_received_bytes_total
countercomponent_id
instead. The value is the same as component_id
.component_received_event_bytes_total
countercomponent_id
instead. The value is the same as component_id
.component_received_events_total
countercomponent_id
instead. The value is the same as component_id
.component_sent_event_bytes_total
countercomponent_id
instead. The value is the same as component_id
.component_sent_events_total
countercomponent_id
instead. The value is the same as component_id
.events_in_total
countercomponent_received_events_total
instead.component_id
instead. The value is the same as component_id
.events_out_total
countercomponent_sent_events_total
instead.component_id
instead. The value is the same as component_id
.http_error_response_total
counterhttp_request_errors_total
counterparse_errors_total
counterprocessed_bytes_total
countercomponent_id
instead. The value is the same as component_id
.processed_events_total
countercomponent_received_events_total
and
component_sent_events_total
metrics.component_id
instead. The value is the same as component_id
.request_duration_seconds
histogramrequests_completed_total
countercomponent_id
instead. The value is the same as component_id
.source_lag_time_seconds
histogramcomponent_id
instead. The value is the same as component_id
.How it works
Duplicate tag names
Transport Layer Security (TLS)
tls.*
options.