CAUTION: This page documents an old version of Prometheus. Check out the latest stable version.

Configuration

Prometheus is configured via command-line flags and a configuration file. While the command-line flags configure immutable system parameters (such as storage locations, amount of data to keep on disk and in memory, etc.), the configuration file defines everything related to scraping jobs and their instances, as well as which rule files to load.

To view all available command-line flags, run ./prometheus -h.

Prometheus can reload its configuration at runtime. If the new configuration is not well-formed, the changes will not be applied. A configuration reload is triggered by sending a SIGHUP to the Prometheus process or sending a HTTP POST request to the /-/reload endpoint (when the --web.enable-lifecycle flag is enabled). This will also reload any configured rule files.

Configuration file

To specify which configuration file to load, use the --config.file flag.

The file is written in YAML format, defined by the scheme described below. Brackets indicate that a parameter is optional. For non-list parameters the value is set to the specified default.

Generic placeholders are defined as follows:

  • <boolean>: a boolean that can take the values true or false
  • <duration>: a duration matching the regular expression ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0), e.g. 1d, 1h30m, 5m, 10s
  • <filename>: a valid path in the current working directory
  • <float>: a floating-point number
  • <host>: a valid string consisting of a hostname or IP followed by an optional port number
  • <int>: an integer value
  • <labelname>: a string matching the regular expression [a-zA-Z_][a-zA-Z0-9_]*
  • <labelvalue>: a string of unicode characters
  • <path>: a valid URL path
  • <scheme>: a string that can take the values http or https
  • <secret>: a regular string that is a secret, such as a password
  • <string>: a regular string
  • <size>: a size in bytes, e.g. 512MB. A unit is required. Supported units: B, KB, MB, GB, TB, PB, EB.
  • <tmpl_string>: a string which is template-expanded before usage

The other placeholders are specified separately.

A valid example file can be found here.

The global configuration specifies parameters that are valid in all other configuration contexts. They also serve as defaults for other configuration sections.

  1. global:
  2. # How frequently to scrape targets by default.
  3. [ scrape_interval: <duration> | default = 1m ]
  4. # How long until a scrape request times out.
  5. [ scrape_timeout: <duration> | default = 10s ]
  6. # How frequently to evaluate rules.
  7. [ evaluation_interval: <duration> | default = 1m ]
  8. # The labels to add to any time series or alerts when communicating with
  9. # external systems (federation, remote storage, Alertmanager).
  10. external_labels:
  11. [ <labelname>: <labelvalue> ... ]
  12. # File to which PromQL queries are logged.
  13. # Reloading the configuration will reopen the file.
  14. [ query_log_file: <string> ]
  15. # Rule files specifies a list of globs. Rules and alerts are read from
  16. # all matching files.
  17. rule_files:
  18. [ - <filepath_glob> ... ]
  19. # A list of scrape configurations.
  20. scrape_configs:
  21. [ - <scrape_config> ... ]
  22. # Alerting specifies settings related to the Alertmanager.
  23. alerting:
  24. alert_relabel_configs:
  25. [ - <relabel_config> ... ]
  26. alertmanagers:
  27. [ - <alertmanager_config> ... ]
  28. # Settings related to the remote write feature.
  29. remote_write:
  30. [ - <remote_write> ... ]
  31. # Settings related to the remote read feature.
  32. remote_read:
  33. [ - <remote_read> ... ]
  34. # Storage related settings that are runtime reloadable.
  35. storage:
  36. [ tsdb: <tsdb> ]
  37. [ exemplars: <exemplars> ]
  38. # Configures exporting traces.
  39. tracing:
  40. [ <tracing_config> ]

<scrape_config>

A scrape_config section specifies a set of targets and parameters describing how to scrape them. In the general case, one scrape configuration specifies a single job. In advanced configurations, this may change.

Targets may be statically configured via the static_configs parameter or dynamically discovered using one of the supported service-discovery mechanisms.

Additionally, relabel_configs allow advanced modifications to any target and its labels before scraping.

  1. # The job name assigned to scraped metrics by default.
  2. job_name: <job_name>
  3. # How frequently to scrape targets from this job.
  4. [ scrape_interval: <duration> | default = <global_config.scrape_interval> ]
  5. # Per-scrape timeout when scraping this job.
  6. [ scrape_timeout: <duration> | default = <global_config.scrape_timeout> ]
  7. # The HTTP resource path on which to fetch metrics from targets.
  8. [ metrics_path: <path> | default = /metrics ]
  9. # honor_labels controls how Prometheus handles conflicts between labels that are
  10. # already present in scraped data and labels that Prometheus would attach
  11. # server-side ("job" and "instance" labels, manually configured target
  12. # labels, and labels generated by service discovery implementations).
  13. #
  14. # If honor_labels is set to "true", label conflicts are resolved by keeping label
  15. # values from the scraped data and ignoring the conflicting server-side labels.
  16. #
  17. # If honor_labels is set to "false", label conflicts are resolved by renaming
  18. # conflicting labels in the scraped data to "exported_<original-label>" (for
  19. # example "exported_instance", "exported_job") and then attaching server-side
  20. # labels.
  21. #
  22. # Setting honor_labels to "true" is useful for use cases such as federation and
  23. # scraping the Pushgateway, where all labels specified in the target should be
  24. # preserved.
  25. #
  26. # Note that any globally configured "external_labels" are unaffected by this
  27. # setting. In communication with external systems, they are always applied only
  28. # when a time series does not have a given label yet and are ignored otherwise.
  29. [ honor_labels: <boolean> | default = false ]
  30. # honor_timestamps controls whether Prometheus respects the timestamps present
  31. # in scraped data.
  32. #
  33. # If honor_timestamps is set to "true", the timestamps of the metrics exposed
  34. # by the target will be used.
  35. #
  36. # If honor_timestamps is set to "false", the timestamps of the metrics exposed
  37. # by the target will be ignored.
  38. [ honor_timestamps: <boolean> | default = true ]
  39. # Configures the protocol scheme used for requests.
  40. [ scheme: <scheme> | default = http ]
  41. # Optional HTTP URL parameters.
  42. params:
  43. [ <string>: [<string>, ...] ]
  44. # Sets the `Authorization` header on every scrape request with the
  45. # configured username and password.
  46. # password and password_file are mutually exclusive.
  47. basic_auth:
  48. [ username: <string> ]
  49. [ password: <secret> ]
  50. [ password_file: <string> ]
  51. # Sets the `Authorization` header on every scrape request with
  52. # the configured credentials.
  53. authorization:
  54. # Sets the authentication type of the request.
  55. [ type: <string> | default: Bearer ]
  56. # Sets the credentials of the request. It is mutually exclusive with
  57. # `credentials_file`.
  58. [ credentials: <secret> ]
  59. # Sets the credentials of the request with the credentials read from the
  60. # configured file. It is mutually exclusive with `credentials`.
  61. [ credentials_file: <filename> ]
  62. # Optional OAuth 2.0 configuration.
  63. # Cannot be used at the same time as basic_auth or authorization.
  64. oauth2:
  65. [ <oauth2> ]
  66. # Configure whether scrape requests follow HTTP 3xx redirects.
  67. [ follow_redirects: <boolean> | default = true ]
  68. # Whether to enable HTTP2.
  69. [ enable_http2: <bool> | default: true ]
  70. # Configures the scrape request's TLS settings.
  71. tls_config:
  72. [ <tls_config> ]
  73. # Optional proxy URL.
  74. [ proxy_url: <string> ]
  75. # Specifies headers to send to proxies during CONNECT requests.
  76. [ proxy_connect_headers:
  77. [ <string>: [<secret>, ...] ] ]
  78. # List of Azure service discovery configurations.
  79. azure_sd_configs:
  80. [ - <azure_sd_config> ... ]
  81. # List of Consul service discovery configurations.
  82. consul_sd_configs:
  83. [ - <consul_sd_config> ... ]
  84. # List of DigitalOcean service discovery configurations.
  85. digitalocean_sd_configs:
  86. [ - <digitalocean_sd_config> ... ]
  87. # List of Docker service discovery configurations.
  88. docker_sd_configs:
  89. [ - <docker_sd_config> ... ]
  90. # List of Docker Swarm service discovery configurations.
  91. dockerswarm_sd_configs:
  92. [ - <dockerswarm_sd_config> ... ]
  93. # List of DNS service discovery configurations.
  94. dns_sd_configs:
  95. [ - <dns_sd_config> ... ]
  96. # List of EC2 service discovery configurations.
  97. ec2_sd_configs:
  98. [ - <ec2_sd_config> ... ]
  99. # List of Eureka service discovery configurations.
  100. eureka_sd_configs:
  101. [ - <eureka_sd_config> ... ]
  102. # List of file service discovery configurations.
  103. file_sd_configs:
  104. [ - <file_sd_config> ... ]
  105. # List of GCE service discovery configurations.
  106. gce_sd_configs:
  107. [ - <gce_sd_config> ... ]
  108. # List of Hetzner service discovery configurations.
  109. hetzner_sd_configs:
  110. [ - <hetzner_sd_config> ... ]
  111. # List of HTTP service discovery configurations.
  112. http_sd_configs:
  113. [ - <http_sd_config> ... ]
  114. # List of IONOS service discovery configurations.
  115. ionos_sd_configs:
  116. [ - <ionos_sd_config> ... ]
  117. # List of Kubernetes service discovery configurations.
  118. kubernetes_sd_configs:
  119. [ - <kubernetes_sd_config> ... ]
  120. # List of Kuma service discovery configurations.
  121. kuma_sd_configs:
  122. [ - <kuma_sd_config> ... ]
  123. # List of Lightsail service discovery configurations.
  124. lightsail_sd_configs:
  125. [ - <lightsail_sd_config> ... ]
  126. # List of Linode service discovery configurations.
  127. linode_sd_configs:
  128. [ - <linode_sd_config> ... ]
  129. # List of Marathon service discovery configurations.
  130. marathon_sd_configs:
  131. [ - <marathon_sd_config> ... ]
  132. # List of AirBnB's Nerve service discovery configurations.
  133. nerve_sd_configs:
  134. [ - <nerve_sd_config> ... ]
  135. # List of Nomad service discovery configurations.
  136. nomad_sd_configs:
  137. [ - <nomad_sd_config> ... ]
  138. # List of OpenStack service discovery configurations.
  139. openstack_sd_configs:
  140. [ - <openstack_sd_config> ... ]
  141. # List of OVHcloud service discovery configurations.
  142. ovhcloud_sd_configs:
  143. [ - <ovhcloud_sd_config> ... ]
  144. # List of PuppetDB service discovery configurations.
  145. puppetdb_sd_configs:
  146. [ - <puppetdb_sd_config> ... ]
  147. # List of Scaleway service discovery configurations.
  148. scaleway_sd_configs:
  149. [ - <scaleway_sd_config> ... ]
  150. # List of Zookeeper Serverset service discovery configurations.
  151. serverset_sd_configs:
  152. [ - <serverset_sd_config> ... ]
  153. # List of Triton service discovery configurations.
  154. triton_sd_configs:
  155. [ - <triton_sd_config> ... ]
  156. # List of Uyuni service discovery configurations.
  157. uyuni_sd_configs:
  158. [ - <uyuni_sd_config> ... ]
  159. # List of labeled statically configured targets for this job.
  160. static_configs:
  161. [ - <static_config> ... ]
  162. # List of target relabel configurations.
  163. relabel_configs:
  164. [ - <relabel_config> ... ]
  165. # List of metric relabel configurations.
  166. metric_relabel_configs:
  167. [ - <relabel_config> ... ]
  168. # An uncompressed response body larger than this many bytes will cause the
  169. # scrape to fail. 0 means no limit. Example: 100MB.
  170. # This is an experimental feature, this behaviour could
  171. # change or be removed in the future.
  172. [ body_size_limit: <size> | default = 0 ]
  173. # Per-scrape limit on number of scraped samples that will be accepted.
  174. # If more than this number of samples are present after metric relabeling
  175. # the entire scrape will be treated as failed. 0 means no limit.
  176. [ sample_limit: <int> | default = 0 ]
  177. # Per-scrape limit on number of labels that will be accepted for a sample. If
  178. # more than this number of labels are present post metric-relabeling, the
  179. # entire scrape will be treated as failed. 0 means no limit.
  180. [ label_limit: <int> | default = 0 ]
  181. # Per-scrape limit on length of labels name that will be accepted for a sample.
  182. # If a label name is longer than this number post metric-relabeling, the entire
  183. # scrape will be treated as failed. 0 means no limit.
  184. [ label_name_length_limit: <int> | default = 0 ]
  185. # Per-scrape limit on length of labels value that will be accepted for a sample.
  186. # If a label value is longer than this number post metric-relabeling, the
  187. # entire scrape will be treated as failed. 0 means no limit.
  188. [ label_value_length_limit: <int> | default = 0 ]
  189. # Per-scrape config limit on number of unique targets that will be
  190. # accepted. If more than this number of targets are present after target
  191. # relabeling, Prometheus will mark the targets as failed without scraping them.
  192. # 0 means no limit. This is an experimental feature, this behaviour could
  193. # change in the future.
  194. [ target_limit: <int> | default = 0 ]

Where <job_name> must be unique across all scrape configurations.

<tls_config>

A tls_config allows configuring TLS connections.

  1. # CA certificate to validate API server certificate with.
  2. [ ca_file: <filename> ]
  3. # Certificate and key files for client cert authentication to the server.
  4. [ cert_file: <filename> ]
  5. [ key_file: <filename> ]
  6. # ServerName extension to indicate the name of the server.
  7. # https://tools.ietf.org/html/rfc4366#section-3.1
  8. [ server_name: <string> ]
  9. # Disable validation of the server certificate.
  10. [ insecure_skip_verify: <boolean> ]
  11. # Minimum acceptable TLS version. Accepted values: TLS10 (TLS 1.0), TLS11 (TLS
  12. # 1.1), TLS12 (TLS 1.2), TLS13 (TLS 1.3).
  13. # If unset, Prometheus will use Go default minimum version, which is TLS 1.2.
  14. # See MinVersion in https://pkg.go.dev/crypto/tls#Config.
  15. [ min_version: <string> ]
  16. # Maximum acceptable TLS version. Accepted values: TLS10 (TLS 1.0), TLS11 (TLS
  17. # 1.1), TLS12 (TLS 1.2), TLS13 (TLS 1.3).
  18. # If unset, Prometheus will use Go default maximum version, which is TLS 1.3.
  19. # See MaxVersion in https://pkg.go.dev/crypto/tls#Config.
  20. [ max_version: <string> ]

<oauth2>

OAuth 2.0 authentication using the client credentials grant type. Prometheus fetches an access token from the specified endpoint with the given client access and secret keys.

  1. client_id: <string>
  2. [ client_secret: <secret> ]
  3. # Read the client secret from a file.
  4. # It is mutually exclusive with `client_secret`.
  5. [ client_secret_file: <filename> ]
  6. # Scopes for the token request.
  7. scopes:
  8. [ - <string> ... ]
  9. # The URL to fetch the token from.
  10. token_url: <string>
  11. # Optional parameters to append to the token URL.
  12. endpoint_params:
  13. [ <string>: <string> ... ]
  14. # Configures the token request's TLS settings.
  15. tls_config:
  16. [ <tls_config> ]
  17. # Optional proxy URL.
  18. [ proxy_url: <string> ]
  19. # Specifies headers to send to proxies during CONNECT requests.
  20. [ proxy_connect_headers:
  21. [ <string>: [<secret>, ...] ] ]

<azure_sd_config>

Azure SD configurations allow retrieving scrape targets from Azure VMs.

The following meta labels are available on targets during relabeling:

  • __meta_azure_machine_id: the machine ID
  • __meta_azure_machine_location: the location the machine runs in
  • __meta_azure_machine_name: the machine name
  • __meta_azure_machine_computer_name: the machine computer name
  • __meta_azure_machine_os_type: the machine operating system
  • __meta_azure_machine_private_ip: the machine’s private IP
  • __meta_azure_machine_public_ip: the machine’s public IP if it exists
  • __meta_azure_machine_resource_group: the machine’s resource group
  • __meta_azure_machine_tag_<tagname>: each tag value of the machine
  • __meta_azure_machine_scale_set: the name of the scale set which the vm is part of (this value is only set if you are using a scale set)
  • __meta_azure_subscription_id: the subscription ID
  • __meta_azure_tenant_id: the tenant ID

See below for the configuration options for Azure discovery:

  1. # The information to access the Azure API.
  2. # The Azure environment.
  3. [ environment: <string> | default = AzurePublicCloud ]
  4. # The authentication method, either OAuth or ManagedIdentity.
  5. # See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview
  6. [ authentication_method: <string> | default = OAuth]
  7. # The subscription ID. Always required.
  8. subscription_id: <string>
  9. # Optional tenant ID. Only required with authentication_method OAuth.
  10. [ tenant_id: <string> ]
  11. # Optional client ID. Only required with authentication_method OAuth.
  12. [ client_id: <string> ]
  13. # Optional client secret. Only required with authentication_method OAuth.
  14. [ client_secret: <secret> ]
  15. # Optional resource group name. Limits discovery to this resource group.
  16. [ resource_group: <string> ]
  17. # Refresh interval to re-read the instance list.
  18. [ refresh_interval: <duration> | default = 300s ]
  19. # The port to scrape metrics from. If using the public IP address, this must
  20. # instead be specified in the relabeling rule.
  21. [ port: <int> | default = 80 ]
  22. # Authentication information used to authenticate to the Azure API.
  23. # Note that `basic_auth`, `authorization` and `oauth2` options are
  24. # mutually exclusive.
  25. # `password` and `password_file` are mutually exclusive.
  26. # Optional HTTP basic authentication information, currently not support by Azure.
  27. basic_auth:
  28. [ username: <string> ]
  29. [ password: <secret> ]
  30. [ password_file: <string> ]
  31. # Optional `Authorization` header configuration, currently not supported by Azure.
  32. authorization:
  33. # Sets the authentication type.
  34. [ type: <string> | default: Bearer ]
  35. # Sets the credentials. It is mutually exclusive with
  36. # `credentials_file`.
  37. [ credentials: <secret> ]
  38. # Sets the credentials to the credentials read from the configured file.
  39. # It is mutually exclusive with `credentials`.
  40. [ credentials_file: <filename> ]
  41. # Optional OAuth 2.0 configuration, currently not supported by Azure.
  42. oauth2:
  43. [ <oauth2> ]
  44. # Optional proxy URL.
  45. [ proxy_url: <string> ]
  46. # Specifies headers to send to proxies during CONNECT requests.
  47. [ proxy_connect_headers:
  48. [ <string>: [<secret>, ...] ] ]
  49. # Configure whether HTTP requests follow HTTP 3xx redirects.
  50. [ follow_redirects: <boolean> | default = true ]
  51. # Whether to enable HTTP2.
  52. [ enable_http2: <bool> | default: true ]
  53. # TLS configuration.
  54. tls_config:
  55. [ <tls_config> ]

<consul_sd_config>

Consul SD configurations allow retrieving scrape targets from Consul’s Catalog API.

The following meta labels are available on targets during relabeling:

  • __meta_consul_address: the address of the target
  • __meta_consul_dc: the datacenter name for the target
  • __meta_consul_health: the health status of the service
  • __meta_consul_partition: the admin partition name where the service is registered
  • __meta_consul_metadata_<key>: each node metadata key value of the target
  • __meta_consul_node: the node name defined for the target
  • __meta_consul_service_address: the service address of the target
  • __meta_consul_service_id: the service ID of the target
  • __meta_consul_service_metadata_<key>: each service metadata key value of the target
  • __meta_consul_service_port: the service port of the target
  • __meta_consul_service: the name of the service the target belongs to
  • __meta_consul_tagged_address_<key>: each node tagged address key value of the target
  • __meta_consul_tags: the list of tags of the target joined by the tag separator
  1. # The information to access the Consul API. It is to be defined
  2. # as the Consul documentation requires.
  3. [ server: <host> | default = "localhost:8500" ]
  4. [ token: <secret> ]
  5. [ datacenter: <string> ]
  6. # Namespaces are only supported in Consul Enterprise.
  7. [ namespace: <string> ]
  8. # Admin Partitions are only supported in Consul Enterprise.
  9. [ partition: <string> ]
  10. [ scheme: <string> | default = "http" ]
  11. # The username and password fields are deprecated in favor of the basic_auth configuration.
  12. [ username: <string> ]
  13. [ password: <secret> ]
  14. # A list of services for which targets are retrieved. If omitted, all services
  15. # are scraped.
  16. services:
  17. [ - <string> ]
  18. # See https://www.consul.io/api/catalog.html#list-nodes-for-service to know more
  19. # about the possible filters that can be used.
  20. # An optional list of tags used to filter nodes for a given service. Services must contain all tags in the list.
  21. tags:
  22. [ - <string> ]
  23. # Node metadata key/value pairs to filter nodes for a given service.
  24. [ node_meta:
  25. [ <string>: <string> ... ] ]
  26. # The string by which Consul tags are joined into the tag label.
  27. [ tag_separator: <string> | default = , ]
  28. # Allow stale Consul results (see https://www.consul.io/api/features/consistency.html). Will reduce load on Consul.
  29. [ allow_stale: <boolean> | default = true ]
  30. # The time after which the provided names are refreshed.
  31. # On large setup it might be a good idea to increase this value because the catalog will change all the time.
  32. [ refresh_interval: <duration> | default = 30s ]
  33. # Authentication information used to authenticate to the consul server.
  34. # Note that `basic_auth`, `authorization` and `oauth2` options are
  35. # mutually exclusive.
  36. # `password` and `password_file` are mutually exclusive.
  37. # Optional HTTP basic authentication information.
  38. basic_auth:
  39. [ username: <string> ]
  40. [ password: <secret> ]
  41. [ password_file: <string> ]
  42. # Optional `Authorization` header configuration.
  43. authorization:
  44. # Sets the authentication type.
  45. [ type: <string> | default: Bearer ]
  46. # Sets the credentials. It is mutually exclusive with
  47. # `credentials_file`.
  48. [ credentials: <secret> ]
  49. # Sets the credentials to the credentials read from the configured file.
  50. # It is mutually exclusive with `credentials`.
  51. [ credentials_file: <filename> ]
  52. # Optional OAuth 2.0 configuration.
  53. oauth2:
  54. [ <oauth2> ]
  55. # Optional proxy URL.
  56. [ proxy_url: <string> ]
  57. # Specifies headers to send to proxies during CONNECT requests.
  58. [ proxy_connect_headers:
  59. [ <string>: [<secret>, ...] ] ]
  60. # Configure whether HTTP requests follow HTTP 3xx redirects.
  61. [ follow_redirects: <boolean> | default = true ]
  62. # Whether to enable HTTP2.
  63. [ enable_http2: <bool> | default: true ]
  64. # TLS configuration.
  65. tls_config:
  66. [ <tls_config> ]

Note that the IP number and port used to scrape the targets is assembled as <__meta_consul_address>:<__meta_consul_service_port>. However, in some Consul setups, the relevant address is in __meta_consul_service_address. In those cases, you can use the relabel feature to replace the special __address__ label.

The relabeling phase is the preferred and more powerful way to filter services or nodes for a service based on arbitrary labels. For users with thousands of services it can be more efficient to use the Consul API directly which has basic support for filtering nodes (currently by node metadata and a single tag).

<digitalocean_sd_config>

DigitalOcean SD configurations allow retrieving scrape targets from DigitalOcean’s Droplets API. This service discovery uses the public IPv4 address by default, by that can be changed with relabeling, as demonstrated in the Prometheus digitalocean-sd configuration file.

The following meta labels are available on targets during relabeling:

  • __meta_digitalocean_droplet_id: the id of the droplet
  • __meta_digitalocean_droplet_name: the name of the droplet
  • __meta_digitalocean_image: the slug of the droplet’s image
  • __meta_digitalocean_image_name: the display name of the droplet’s image
  • __meta_digitalocean_private_ipv4: the private IPv4 of the droplet
  • __meta_digitalocean_public_ipv4: the public IPv4 of the droplet
  • __meta_digitalocean_public_ipv6: the public IPv6 of the droplet
  • __meta_digitalocean_region: the region of the droplet
  • __meta_digitalocean_size: the size of the droplet
  • __meta_digitalocean_status: the status of the droplet
  • __meta_digitalocean_features: the comma-separated list of features of the droplet
  • __meta_digitalocean_tags: the comma-separated list of tags of the droplet
  • __meta_digitalocean_vpc: the id of the droplet’s VPC
  1. # Authentication information used to authenticate to the API server.
  2. # Note that `basic_auth` and `authorization` options are
  3. # mutually exclusive.
  4. # password and password_file are mutually exclusive.
  5. # Optional HTTP basic authentication information, not currently supported by DigitalOcean.
  6. basic_auth:
  7. [ username: <string> ]
  8. [ password: <secret> ]
  9. [ password_file: <string> ]
  10. # Optional `Authorization` header configuration.
  11. authorization:
  12. # Sets the authentication type.
  13. [ type: <string> | default: Bearer ]
  14. # Sets the credentials. It is mutually exclusive with
  15. # `credentials_file`.
  16. [ credentials: <secret> ]
  17. # Sets the credentials to the credentials read from the configured file.
  18. # It is mutually exclusive with `credentials`.
  19. [ credentials_file: <filename> ]
  20. # Optional OAuth 2.0 configuration.
  21. # Cannot be used at the same time as basic_auth or authorization.
  22. oauth2:
  23. [ <oauth2> ]
  24. # Optional proxy URL.
  25. [ proxy_url: <string> ]
  26. # Specifies headers to send to proxies during CONNECT requests.
  27. [ proxy_connect_headers:
  28. [ <string>: [<secret>, ...] ] ]
  29. # Configure whether HTTP requests follow HTTP 3xx redirects.
  30. [ follow_redirects: <boolean> | default = true ]
  31. # Whether to enable HTTP2.
  32. [ enable_http2: <bool> | default: true ]
  33. # TLS configuration.
  34. tls_config:
  35. [ <tls_config> ]
  36. # The port to scrape metrics from.
  37. [ port: <int> | default = 80 ]
  38. # The time after which the droplets are refreshed.
  39. [ refresh_interval: <duration> | default = 60s ]

<docker_sd_config>

Docker SD configurations allow retrieving scrape targets from Docker Engine hosts.

This SD discovers “containers” and will create a target for each network IP and port the container is configured to expose.

Available meta labels:

  • __meta_docker_container_id: the id of the container
  • __meta_docker_container_name: the name of the container
  • __meta_docker_container_network_mode: the network mode of the container
  • __meta_docker_container_label_<labelname>: each label of the container
  • __meta_docker_network_id: the ID of the network
  • __meta_docker_network_name: the name of the network
  • __meta_docker_network_ingress: whether the network is ingress
  • __meta_docker_network_internal: whether the network is internal
  • __meta_docker_network_label_<labelname>: each label of the network
  • __meta_docker_network_scope: the scope of the network
  • __meta_docker_network_ip: the IP of the container in this network
  • __meta_docker_port_private: the port on the container
  • __meta_docker_port_public: the external port if a port-mapping exists
  • __meta_docker_port_public_ip: the public IP if a port-mapping exists

See below for the configuration options for Docker discovery:

  1. # Address of the Docker daemon.
  2. host: <string>
  3. # Optional proxy URL.
  4. [ proxy_url: <string> ]
  5. # Specifies headers to send to proxies during CONNECT requests.
  6. [ proxy_connect_headers:
  7. [ <string>: [<secret>, ...] ] ]
  8. # TLS configuration.
  9. tls_config:
  10. [ <tls_config> ]
  11. # The port to scrape metrics from, when `role` is nodes, and for discovered
  12. # tasks and services that don't have published ports.
  13. [ port: <int> | default = 80 ]
  14. # The host to use if the container is in host networking mode.
  15. [ host_networking_host: <string> | default = "localhost" ]
  16. # Optional filters to limit the discovery process to a subset of available
  17. # resources.
  18. # The available filters are listed in the upstream documentation:
  19. # https://docs.docker.com/engine/api/v1.40/#operation/ContainerList
  20. [ filters:
  21. [ - name: <string>
  22. values: <string>, [...] ]
  23. # The time after which the containers are refreshed.
  24. [ refresh_interval: <duration> | default = 60s ]
  25. # Authentication information used to authenticate to the Docker daemon.
  26. # Note that `basic_auth` and `authorization` options are
  27. # mutually exclusive.
  28. # password and password_file are mutually exclusive.
  29. # Optional HTTP basic authentication information.
  30. basic_auth:
  31. [ username: <string> ]
  32. [ password: <secret> ]
  33. [ password_file: <string> ]
  34. # Optional `Authorization` header configuration.
  35. authorization:
  36. # Sets the authentication type.
  37. [ type: <string> | default: Bearer ]
  38. # Sets the credentials. It is mutually exclusive with
  39. # `credentials_file`.
  40. [ credentials: <secret> ]
  41. # Sets the credentials to the credentials read from the configured file.
  42. # It is mutually exclusive with `credentials`.
  43. [ credentials_file: <filename> ]
  44. # Optional OAuth 2.0 configuration.
  45. # Cannot be used at the same time as basic_auth or authorization.
  46. oauth2:
  47. [ <oauth2> ]
  48. # Configure whether HTTP requests follow HTTP 3xx redirects.
  49. [ follow_redirects: <boolean> | default = true ]
  50. # Whether to enable HTTP2.
  51. [ enable_http2: <bool> | default: true ]

The relabeling phase is the preferred and more powerful way to filter containers. For users with thousands of containers it can be more efficient to use the Docker API directly which has basic support for filtering containers (using filters).

See this example Prometheus configuration file for a detailed example of configuring Prometheus for Docker Engine.

<dockerswarm_sd_config>

Docker Swarm SD configurations allow retrieving scrape targets from Docker Swarm engine.

One of the following roles can be configured to discover targets:

services

The services role discovers all Swarm services and exposes their ports as targets. For each published port of a service, a single target is generated. If a service has no published ports, a target per service is created using the port parameter defined in the SD configuration.

Available meta labels:

  • __meta_dockerswarm_service_id: the id of the service
  • __meta_dockerswarm_service_name: the name of the service
  • __meta_dockerswarm_service_mode: the mode of the service
  • __meta_dockerswarm_service_endpoint_port_name: the name of the endpoint port, if available
  • __meta_dockerswarm_service_endpoint_port_publish_mode: the publish mode of the endpoint port
  • __meta_dockerswarm_service_label_<labelname>: each label of the service
  • __meta_dockerswarm_service_task_container_hostname: the container hostname of the target, if available
  • __meta_dockerswarm_service_task_container_image: the container image of the target
  • __meta_dockerswarm_service_updating_status: the status of the service, if available
  • __meta_dockerswarm_network_id: the ID of the network
  • __meta_dockerswarm_network_name: the name of the network
  • __meta_dockerswarm_network_ingress: whether the network is ingress
  • __meta_dockerswarm_network_internal: whether the network is internal
  • __meta_dockerswarm_network_label_<labelname>: each label of the network
  • __meta_dockerswarm_network_scope: the scope of the network

tasks

The tasks role discovers all Swarm tasks and exposes their ports as targets. For each published port of a task, a single target is generated. If a task has no published ports, a target per task is created using the port parameter defined in the SD configuration.

Available meta labels:

  • __meta_dockerswarm_container_label_<labelname>: each label of the container
  • __meta_dockerswarm_task_id: the id of the task
  • __meta_dockerswarm_task_container_id: the container id of the task
  • __meta_dockerswarm_task_desired_state: the desired state of the task
  • __meta_dockerswarm_task_slot: the slot of the task
  • __meta_dockerswarm_task_state: the state of the task
  • __meta_dockerswarm_task_port_publish_mode: the publish mode of the task port
  • __meta_dockerswarm_service_id: the id of the service
  • __meta_dockerswarm_service_name: the name of the service
  • __meta_dockerswarm_service_mode: the mode of the service
  • __meta_dockerswarm_service_label_<labelname>: each label of the service
  • __meta_dockerswarm_network_id: the ID of the network
  • __meta_dockerswarm_network_name: the name of the network
  • __meta_dockerswarm_network_ingress: whether the network is ingress
  • __meta_dockerswarm_network_internal: whether the network is internal
  • __meta_dockerswarm_network_label_<labelname>: each label of the network
  • __meta_dockerswarm_network_label: each label of the network
  • __meta_dockerswarm_network_scope: the scope of the network
  • __meta_dockerswarm_node_id: the ID of the node
  • __meta_dockerswarm_node_hostname: the hostname of the node
  • __meta_dockerswarm_node_address: the address of the node
  • __meta_dockerswarm_node_availability: the availability of the node
  • __meta_dockerswarm_node_label_<labelname>: each label of the node
  • __meta_dockerswarm_node_platform_architecture: the architecture of the node
  • __meta_dockerswarm_node_platform_os: the operating system of the node
  • __meta_dockerswarm_node_role: the role of the node
  • __meta_dockerswarm_node_status: the status of the node

The __meta_dockerswarm_network_* meta labels are not populated for ports which are published with mode=host.

nodes

The nodes role is used to discover Swarm nodes.

Available meta labels:

  • __meta_dockerswarm_node_address: the address of the node
  • __meta_dockerswarm_node_availability: the availability of the node
  • __meta_dockerswarm_node_engine_version: the version of the node engine
  • __meta_dockerswarm_node_hostname: the hostname of the node
  • __meta_dockerswarm_node_id: the ID of the node
  • __meta_dockerswarm_node_label_<labelname>: each label of the node
  • __meta_dockerswarm_node_manager_address: the address of the manager component of the node
  • __meta_dockerswarm_node_manager_leader: the leadership status of the manager component of the node (true or false)
  • __meta_dockerswarm_node_manager_reachability: the reachability of the manager component of the node
  • __meta_dockerswarm_node_platform_architecture: the architecture of the node
  • __meta_dockerswarm_node_platform_os: the operating system of the node
  • __meta_dockerswarm_node_role: the role of the node
  • __meta_dockerswarm_node_status: the status of the node

See below for the configuration options for Docker Swarm discovery:

  1. # Address of the Docker daemon.
  2. host: <string>
  3. # Optional proxy URL.
  4. [ proxy_url: <string> ]
  5. # Specifies headers to send to proxies during CONNECT requests.
  6. [ proxy_connect_headers:
  7. [ <string>: [<secret>, ...] ] ]
  8. # TLS configuration.
  9. tls_config:
  10. [ <tls_config> ]
  11. # Role of the targets to retrieve. Must be `services`, `tasks`, or `nodes`.
  12. role: <string>
  13. # The port to scrape metrics from, when `role` is nodes, and for discovered
  14. # tasks and services that don't have published ports.
  15. [ port: <int> | default = 80 ]
  16. # Optional filters to limit the discovery process to a subset of available
  17. # resources.
  18. # The available filters are listed in the upstream documentation:
  19. # Services: https://docs.docker.com/engine/api/v1.40/#operation/ServiceList
  20. # Tasks: https://docs.docker.com/engine/api/v1.40/#operation/TaskList
  21. # Nodes: https://docs.docker.com/engine/api/v1.40/#operation/NodeList
  22. [ filters:
  23. [ - name: <string>
  24. values: <string>, [...] ]
  25. # The time after which the service discovery data is refreshed.
  26. [ refresh_interval: <duration> | default = 60s ]
  27. # Authentication information used to authenticate to the Docker daemon.
  28. # Note that `basic_auth` and `authorization` options are
  29. # mutually exclusive.
  30. # password and password_file are mutually exclusive.
  31. # Optional HTTP basic authentication information.
  32. basic_auth:
  33. [ username: <string> ]
  34. [ password: <secret> ]
  35. [ password_file: <string> ]
  36. # Optional `Authorization` header configuration.
  37. authorization:
  38. # Sets the authentication type.
  39. [ type: <string> | default: Bearer ]
  40. # Sets the credentials. It is mutually exclusive with
  41. # `credentials_file`.
  42. [ credentials: <secret> ]
  43. # Sets the credentials to the credentials read from the configured file.
  44. # It is mutually exclusive with `credentials`.
  45. [ credentials_file: <filename> ]
  46. # Optional OAuth 2.0 configuration.
  47. # Cannot be used at the same time as basic_auth or authorization.
  48. oauth2:
  49. [ <oauth2> ]
  50. # Configure whether HTTP requests follow HTTP 3xx redirects.
  51. [ follow_redirects: <boolean> | default = true ]
  52. # Whether to enable HTTP2.
  53. [ enable_http2: <bool> | default: true ]

The relabeling phase is the preferred and more powerful way to filter tasks, services or nodes. For users with thousands of tasks it can be more efficient to use the Swarm API directly which has basic support for filtering nodes (using filters).

See this example Prometheus configuration file for a detailed example of configuring Prometheus for Docker Swarm.

<dns_sd_config>

A DNS-based service discovery configuration allows specifying a set of DNS domain names which are periodically queried to discover a list of targets. The DNS servers to be contacted are read from /etc/resolv.conf.

This service discovery method only supports basic DNS A, AAAA, MX and SRV record queries, but not the advanced DNS-SD approach specified in RFC6763.

The following meta labels are available on targets during relabeling:

  • __meta_dns_name: the record name that produced the discovered target.
  • __meta_dns_srv_record_target: the target field of the SRV record
  • __meta_dns_srv_record_port: the port field of the SRV record
  • __meta_dns_mx_record_target: the target field of the MX record
  1. # A list of DNS domain names to be queried.
  2. names:
  3. [ - <string> ]
  4. # The type of DNS query to perform. One of SRV, A, AAAA or MX.
  5. [ type: <string> | default = 'SRV' ]
  6. # The port number used if the query type is not SRV.
  7. [ port: <int>]
  8. # The time after which the provided names are refreshed.
  9. [ refresh_interval: <duration> | default = 30s ]

<ec2_sd_config>

EC2 SD configurations allow retrieving scrape targets from AWS EC2 instances. The private IP address is used by default, but may be changed to the public IP address with relabeling.

The IAM credentials used must have the ec2:DescribeInstances permission to discover scrape targets, and may optionally have the ec2:DescribeAvailabilityZones permission if you want the availability zone ID available as a label (see below).

The following meta labels are available on targets during relabeling:

  • __meta_ec2_ami: the EC2 Amazon Machine Image
  • __meta_ec2_architecture: the architecture of the instance
  • __meta_ec2_availability_zone: the availability zone in which the instance is running
  • __meta_ec2_availability_zone_id: the availability zone ID in which the instance is running (requires ec2:DescribeAvailabilityZones)
  • __meta_ec2_instance_id: the EC2 instance ID
  • __meta_ec2_instance_lifecycle: the lifecycle of the EC2 instance, set only for ‘spot’ or ‘scheduled’ instances, absent otherwise
  • __meta_ec2_instance_state: the state of the EC2 instance
  • __meta_ec2_instance_type: the type of the EC2 instance
  • __meta_ec2_ipv6_addresses: comma separated list of IPv6 addresses assigned to the instance’s network interfaces, if present
  • __meta_ec2_owner_id: the ID of the AWS account that owns the EC2 instance
  • __meta_ec2_platform: the Operating System platform, set to ‘windows’ on Windows servers, absent otherwise
  • __meta_ec2_primary_subnet_id: the subnet ID of the primary network interface, if available
  • __meta_ec2_private_dns_name: the private DNS name of the instance, if available
  • __meta_ec2_private_ip: the private IP address of the instance, if present
  • __meta_ec2_public_dns_name: the public DNS name of the instance, if available
  • __meta_ec2_public_ip: the public IP address of the instance, if available
  • __meta_ec2_region: the region of the instance
  • __meta_ec2_subnet_id: comma separated list of subnets IDs in which the instance is running, if available
  • __meta_ec2_tag_<tagkey>: each tag value of the instance
  • __meta_ec2_vpc_id: the ID of the VPC in which the instance is running, if available

See below for the configuration options for EC2 discovery:

  1. # The information to access the EC2 API.
  2. # The AWS region. If blank, the region from the instance metadata is used.
  3. [ region: <string> ]
  4. # Custom endpoint to be used.
  5. [ endpoint: <string> ]
  6. # The AWS API keys. If blank, the environment variables `AWS_ACCESS_KEY_ID`
  7. # and `AWS_SECRET_ACCESS_KEY` are used.
  8. [ access_key: <string> ]
  9. [ secret_key: <secret> ]
  10. # Named AWS profile used to connect to the API.
  11. [ profile: <string> ]
  12. # AWS Role ARN, an alternative to using AWS API keys.
  13. [ role_arn: <string> ]
  14. # Refresh interval to re-read the instance list.
  15. [ refresh_interval: <duration> | default = 60s ]
  16. # The port to scrape metrics from. If using the public IP address, this must
  17. # instead be specified in the relabeling rule.
  18. [ port: <int> | default = 80 ]
  19. # Filters can be used optionally to filter the instance list by other criteria.
  20. # Available filter criteria can be found here:
  21. # https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html
  22. # Filter API documentation: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Filter.html
  23. filters:
  24. [ - name: <string>
  25. values: <string>, [...] ]
  26. # Authentication information used to authenticate to the EC2 API.
  27. # Note that `basic_auth`, `authorization` and `oauth2` options are
  28. # mutually exclusive.
  29. # `password` and `password_file` are mutually exclusive.
  30. # Optional HTTP basic authentication information, currently not supported by AWS.
  31. basic_auth:
  32. [ username: <string> ]
  33. [ password: <secret> ]
  34. [ password_file: <string> ]
  35. # Optional `Authorization` header configuration, currently not supported by AWS.
  36. authorization:
  37. # Sets the authentication type.
  38. [ type: <string> | default: Bearer ]
  39. # Sets the credentials. It is mutually exclusive with
  40. # `credentials_file`.
  41. [ credentials: <secret> ]
  42. # Sets the credentials to the credentials read from the configured file.
  43. # It is mutuall exclusive with `credentials`.
  44. [ credentials_file: <filename> ]
  45. # Optional OAuth 2.0 configuration, currently not supported by AWS.
  46. oauth2:
  47. [ <oauth2> ]
  48. # Optional proxy URL.
  49. [ proxy_url: <string> ]
  50. # Specifies headers to send to proxies during CONNECT requests.
  51. [ proxy_connect_headers:
  52. [ <string>: [<secret>, ...] ] ]
  53. # Configure whether HTTP requests follow HTTP 3xx redirects.
  54. [ follow_redirects: <boolean> | default = true ]
  55. # Whether to enable HTTP2.
  56. [ enable_http2: <bool> | default: true ]
  57. # TLS configuration.
  58. tls_config:
  59. [ <tls_config> ]

The relabeling phase is the preferred and more powerful way to filter targets based on arbitrary labels. For users with thousands of instances it can be more efficient to use the EC2 API directly which has support for filtering instances.

<openstack_sd_config>

OpenStack SD configurations allow retrieving scrape targets from OpenStack Nova instances.

One of the following <openstack_role> types can be configured to discover targets:

hypervisor

The hypervisor role discovers one target per Nova hypervisor node. The target address defaults to the host_ip attribute of the hypervisor.

The following meta labels are available on targets during relabeling:

  • __meta_openstack_hypervisor_host_ip: the hypervisor node’s IP address.
  • __meta_openstack_hypervisor_hostname: the hypervisor node’s name.
  • __meta_openstack_hypervisor_id: the hypervisor node’s ID.
  • __meta_openstack_hypervisor_state: the hypervisor node’s state.
  • __meta_openstack_hypervisor_status: the hypervisor node’s status.
  • __meta_openstack_hypervisor_type: the hypervisor node’s type.

instance

The instance role discovers one target per network interface of Nova instance. The target address defaults to the private IP address of the network interface.

The following meta labels are available on targets during relabeling:

  • __meta_openstack_address_pool: the pool of the private IP.
  • __meta_openstack_instance_flavor: the flavor of the OpenStack instance.
  • __meta_openstack_instance_id: the OpenStack instance ID.
  • __meta_openstack_instance_name: the OpenStack instance name.
  • __meta_openstack_instance_status: the status of the OpenStack instance.
  • __meta_openstack_private_ip: the private IP of the OpenStack instance.
  • __meta_openstack_project_id: the project (tenant) owning this instance.
  • __meta_openstack_public_ip: the public IP of the OpenStack instance.
  • __meta_openstack_tag_<tagkey>: each tag value of the instance.
  • __meta_openstack_user_id: the user account owning the tenant.

See below for the configuration options for OpenStack discovery:

  1. # The information to access the OpenStack API.
  2. # The OpenStack role of entities that should be discovered.
  3. role: <openstack_role>
  4. # The OpenStack Region.
  5. region: <string>
  6. # identity_endpoint specifies the HTTP endpoint that is required to work with
  7. # the Identity API of the appropriate version. While it's ultimately needed by
  8. # all of the identity services, it will often be populated by a provider-level
  9. # function.
  10. [ identity_endpoint: <string> ]
  11. # username is required if using Identity V2 API. Consult with your provider's
  12. # control panel to discover your account's username. In Identity V3, either
  13. # userid or a combination of username and domain_id or domain_name are needed.
  14. [ username: <string> ]
  15. [ userid: <string> ]
  16. # password for the Identity V2 and V3 APIs. Consult with your provider's
  17. # control panel to discover your account's preferred method of authentication.
  18. [ password: <secret> ]
  19. # At most one of domain_id and domain_name must be provided if using username
  20. # with Identity V3. Otherwise, either are optional.
  21. [ domain_name: <string> ]
  22. [ domain_id: <string> ]
  23. # The project_id and project_name fields are optional for the Identity V2 API.
  24. # Some providers allow you to specify a project_name instead of the project_id.
  25. # Some require both. Your provider's authentication policies will determine
  26. # how these fields influence authentication.
  27. [ project_name: <string> ]
  28. [ project_id: <string> ]
  29. # The application_credential_id or application_credential_name fields are
  30. # required if using an application credential to authenticate. Some providers
  31. # allow you to create an application credential to authenticate rather than a
  32. # password.
  33. [ application_credential_name: <string> ]
  34. [ application_credential_id: <string> ]
  35. # The application_credential_secret field is required if using an application
  36. # credential to authenticate.
  37. [ application_credential_secret: <secret> ]
  38. # Whether the service discovery should list all instances for all projects.
  39. # It is only relevant for the 'instance' role and usually requires admin permissions.
  40. [ all_tenants: <boolean> | default: false ]
  41. # Refresh interval to re-read the instance list.
  42. [ refresh_interval: <duration> | default = 60s ]
  43. # The port to scrape metrics from. If using the public IP address, this must
  44. # instead be specified in the relabeling rule.
  45. [ port: <int> | default = 80 ]
  46. # The availability of the endpoint to connect to. Must be one of public, admin or internal.
  47. [ availability: <string> | default = "public" ]
  48. # TLS configuration.
  49. tls_config:
  50. [ <tls_config> ]

<ovhcloud_sd_config>

OVHcloud SD configurations allow retrieving scrape targets from OVHcloud’s dedicated servers and VPS using their API. Prometheus will periodically check the REST endpoint and create a target for every discovered server. The role will try to use the public IPv4 address as default address, if there’s none it will try to use the IPv6 one. This may be changed with relabeling. For OVHcloud’s public cloud instances you can use the openstacksdconfig.

VPS

  • __meta_ovhcloud_vps_cluster: the cluster of the server
  • __meta_ovhcloud_vps_datacenter: the datacenter of the server
  • __meta_ovhcloud_vps_disk: the disk of the server
  • __meta_ovhcloud_vps_display_name: the display name of the server
  • __meta_ovhcloud_vps_ipv4: the IPv4 of the server
  • __meta_ovhcloud_vps_ipv6: the IPv6 of the server
  • __meta_ovhcloud_vps_keymap: the KVM keyboard layout of the server
  • __meta_ovhcloud_vps_maximum_additional_ip: the maximum additional IPs of the server
  • __meta_ovhcloud_vps_memory_limit: the memory limit of the server
  • __meta_ovhcloud_vps_memory: the memory of the server
  • __meta_ovhcloud_vps_monitoring_ip_blocks: the monitoring IP blocks of the server
  • __meta_ovhcloud_vps_name: the name of the server
  • __meta_ovhcloud_vps_netboot_mode: the netboot mode of the server
  • __meta_ovhcloud_vps_offer_type: the offer type of the server
  • __meta_ovhcloud_vps_offer: the offer of the server
  • __meta_ovhcloud_vps_state: the state of the server
  • __meta_ovhcloud_vps_vcore: the number of virtual cores of the server
  • __meta_ovhcloud_vps_version: the version of the server
  • __meta_ovhcloud_vps_zone: the zone of the server

Dedicated servers

  • __meta_ovhcloud_dedicated_server_commercial_range: the commercial range of the server
  • __meta_ovhcloud_dedicated_server_datacenter: the datacenter of the server
  • __meta_ovhcloud_dedicated_server_ipv4: the IPv4 of the server
  • __meta_ovhcloud_dedicated_server_ipv6: the IPv6 of the server
  • __meta_ovhcloud_dedicated_server_link_speed: the link speed of the server
  • __meta_ovhcloud_dedicated_server_name: the name of the server
  • __meta_ovhcloud_dedicated_server_os: the operating system of the server
  • __meta_ovhcloud_dedicated_server_rack: the rack of the server
  • __meta_ovhcloud_dedicated_server_reverse: the reverse DNS name of the server
  • __meta_ovhcloud_dedicated_server_server_id: the ID of the server
  • __meta_ovhcloud_dedicated_server_state: the state of the server
  • __meta_ovhcloud_dedicated_server_support_level: the support level of the server

See below for the configuration options for OVHcloud discovery:

  1. # Access key to use. https://api.ovh.com
  2. application_key: <string>
  3. application_secret: <secret>
  4. consumer_key: <secret>
  5. # Service of the targets to retrieve. Must be `vps` or `dedicated_server`.
  6. service: <string>
  7. # API endpoint. https://github.com/ovh/go-ovh#supported-apis
  8. [ endpoint: <string> | default = "ovh-eu" ]
  9. # Refresh interval to re-read the resources list.
  10. [ refresh_interval: <duration> | default = 60s ]

<puppetdb_sd_config>

PuppetDB SD configurations allow retrieving scrape targets from PuppetDB resources.

This SD discovers resources and will create a target for each resource returned by the API.

The resource address is the certname of the resource and can be changed during relabeling.

The following meta labels are available on targets during relabeling:

  • __meta_puppetdb_query: the Puppet Query Language (PQL) query
  • __meta_puppetdb_certname: the name of the node associated with the resource
  • __meta_puppetdb_resource: a SHA-1 hash of the resource’s type, title, and parameters, for identification
  • __meta_puppetdb_type: the resource type
  • __meta_puppetdb_title: the resource title
  • __meta_puppetdb_exported: whether the resource is exported ("true" or "false")
  • __meta_puppetdb_tags: comma separated list of resource tags
  • __meta_puppetdb_file: the manifest file in which the resource was declared
  • __meta_puppetdb_environment: the environment of the node associated with the resource
  • __meta_puppetdb_parameter_<parametername>: the parameters of the resource

See below for the configuration options for PuppetDB discovery:

  1. # The URL of the PuppetDB root query endpoint.
  2. url: <string>
  3. # Puppet Query Language (PQL) query. Only resources are supported.
  4. # https://puppet.com/docs/puppetdb/latest/api/query/v4/pql.html
  5. query: <string>
  6. # Whether to include the parameters as meta labels.
  7. # Due to the differences between parameter types and Prometheus labels,
  8. # some parameters might not be rendered. The format of the parameters might
  9. # also change in future releases.
  10. #
  11. # Note: Enabling this exposes parameters in the Prometheus UI and API. Make sure
  12. # that you don't have secrets exposed as parameters if you enable this.
  13. [ include_parameters: <boolean> | default = false ]
  14. # Refresh interval to re-read the resources list.
  15. [ refresh_interval: <duration> | default = 60s ]
  16. # The port to scrape metrics from.
  17. [ port: <int> | default = 80 ]
  18. # TLS configuration to connect to the PuppetDB.
  19. tls_config:
  20. [ <tls_config> ]
  21. # basic_auth, authorization, and oauth2, are mutually exclusive.
  22. # Optional HTTP basic authentication information.
  23. basic_auth:
  24. [ username: <string> ]
  25. [ password: <secret> ]
  26. [ password_file: <string> ]
  27. # `Authorization` HTTP header configuration.
  28. authorization:
  29. # Sets the authentication type.
  30. [ type: <string> | default: Bearer ]
  31. # Sets the credentials. It is mutually exclusive with
  32. # `credentials_file`.
  33. [ credentials: <secret> ]
  34. # Sets the credentials with the credentials read from the configured file.
  35. # It is mutually exclusive with `credentials`.
  36. [ credentials_file: <filename> ]
  37. # Optional OAuth 2.0 configuration.
  38. # Cannot be used at the same time as basic_auth or authorization.
  39. oauth2:
  40. [ <oauth2> ]
  41. # Optional proxy URL.
  42. [ proxy_url: <string> ]
  43. # Specifies headers to send to proxies during CONNECT requests.
  44. [ proxy_connect_headers:
  45. [ <string>: [<secret>, ...] ] ]
  46. # Configure whether HTTP requests follow HTTP 3xx redirects.
  47. [ follow_redirects: <boolean> | default = true ]
  48. # Whether to enable HTTP2.
  49. [ enable_http2: <bool> | default: true ]

See this example Prometheus configuration file for a detailed example of configuring Prometheus with PuppetDB.

<file_sd_config>

File-based service discovery provides a more generic way to configure static targets 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 <static_config>s. Changes to 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-formed target groups are applied.

Files must contain a list of static configs, using these formats:

JSON

  1. [
  2. {
  3. "targets": [ "<host>", ... ],
  4. "labels": {
  5. "<labelname>": "<labelvalue>", ...
  6. }
  7. },
  8. ...
  9. ]

YAML

  1. - targets:
  2. [ - '<host>' ]
  3. labels:
  4. [ <labelname>: <labelvalue> ... ]

As a fallback, the file contents are also re-read periodically at the specified refresh interval.

Each target has a meta label __meta_filepath during the relabeling phase. Its value is set to the filepath from which the target was extracted.

There is a list of integrations with this discovery mechanism.

  1. # Patterns for files from which target groups are extracted.
  2. files:
  3. [ - <filename_pattern> ... ]
  4. # Refresh interval to re-read the files.
  5. [ refresh_interval: <duration> | default = 5m ]

Where <filename_pattern> may be a path ending in .json, .yml or .yaml. The last path segment may contain a single * that matches any character sequence, e.g. my/path/tg_*.json.

<gce_sd_config>

GCE SD configurations allow retrieving scrape targets from GCP GCE instances. The private IP address is used by default, but may be changed to the public IP address with relabeling.

The following meta labels are available on targets during relabeling:

  • __meta_gce_instance_id: the numeric id of the instance
  • __meta_gce_instance_name: the name of the instance
  • __meta_gce_label_<labelname>: each GCE label of the instance
  • __meta_gce_machine_type: full or partial URL of the machine type of the instance
  • __meta_gce_metadata_<name>: each metadata item of the instance
  • __meta_gce_network: the network URL of the instance
  • __meta_gce_private_ip: the private IP address of the instance
  • __meta_gce_interface_ipv4_<name>: IPv4 address of each named interface
  • __meta_gce_project: the GCP project in which the instance is running
  • __meta_gce_public_ip: the public IP address of the instance, if present
  • __meta_gce_subnetwork: the subnetwork URL of the instance
  • __meta_gce_tags: comma separated list of instance tags
  • __meta_gce_zone: the GCE zone URL in which the instance is running

See below for the configuration options for GCE discovery:

  1. # The information to access the GCE API.
  2. # The GCP Project
  3. project: <string>
  4. # The zone of the scrape targets. If you need multiple zones use multiple
  5. # gce_sd_configs.
  6. zone: <string>
  7. # Filter can be used optionally to filter the instance list by other criteria
  8. # Syntax of this filter string is described here in the filter query parameter section:
  9. # https://cloud.google.com/compute/docs/reference/latest/instances/list
  10. [ filter: <string> ]
  11. # Refresh interval to re-read the instance list
  12. [ refresh_interval: <duration> | default = 60s ]
  13. # The port to scrape metrics from. If using the public IP address, this must
  14. # instead be specified in the relabeling rule.
  15. [ port: <int> | default = 80 ]
  16. # The tag separator is used to separate the tags on concatenation
  17. [ tag_separator: <string> | default = , ]

Credentials are discovered by the Google Cloud SDK default client by looking in the following places, preferring the first location found:

  1. a JSON file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable
  2. a JSON file in the well-known path $HOME/.config/gcloud/application_default_credentials.json
  3. fetched from the GCE metadata server

If Prometheus is running within GCE, the service account associated with the instance it is running on should have at least read-only permissions to the compute resources. If running outside of GCE make sure to create an appropriate service account and place the credential file in one of the expected locations.

<hetzner_sd_config>

Hetzner SD configurations allow retrieving scrape targets from Hetzner Cloud API and Robot API. This service discovery uses the public IPv4 address by default, but that can be changed with relabeling, as demonstrated in the Prometheus hetzner-sd configuration file.

The following meta labels are available on all targets during relabeling:

  • __meta_hetzner_server_id: the ID of the server
  • __meta_hetzner_server_name: the name of the server
  • __meta_hetzner_server_status: the status of the server
  • __meta_hetzner_public_ipv4: the public ipv4 address of the server
  • __meta_hetzner_public_ipv6_network: the public ipv6 network (/64) of the server
  • __meta_hetzner_datacenter: the datacenter of the server

The labels below are only available for targets with role set to hcloud:

  • __meta_hetzner_hcloud_image_name: the image name of the server
  • __meta_hetzner_hcloud_image_description: the description of the server image
  • __meta_hetzner_hcloud_image_os_flavor: the OS flavor of the server image
  • __meta_hetzner_hcloud_image_os_version: the OS version of the server image
  • __meta_hetzner_hcloud_datacenter_location: the location of the server
  • __meta_hetzner_hcloud_datacenter_location_network_zone: the network zone of the server
  • __meta_hetzner_hcloud_server_type: the type of the server
  • __meta_hetzner_hcloud_cpu_cores: the CPU cores count of the server
  • __meta_hetzner_hcloud_cpu_type: the CPU type of the server (shared or dedicated)
  • __meta_hetzner_hcloud_memory_size_gb: the amount of memory of the server (in GB)
  • __meta_hetzner_hcloud_disk_size_gb: the disk size of the server (in GB)
  • __meta_hetzner_hcloud_private_ipv4_<networkname>: the private ipv4 address of the server within a given network
  • __meta_hetzner_hcloud_label_<labelname>: each label of the server
  • __meta_hetzner_hcloud_labelpresent_<labelname>: true for each label of the server

The labels below are only available for targets with role set to robot:

  • __meta_hetzner_robot_product: the product of the server
  • __meta_hetzner_robot_cancelled: the server cancellation status
  1. # The Hetzner role of entities that should be discovered.
  2. # One of robot or hcloud.
  3. role: <string>
  4. # Authentication information used to authenticate to the API server.
  5. # Note that `basic_auth` and `authorization` options are
  6. # mutually exclusive.
  7. # password and password_file are mutually exclusive.
  8. # Optional HTTP basic authentication information, required when role is robot
  9. # Role hcloud does not support basic auth.
  10. basic_auth:
  11. [ username: <string> ]
  12. [ password: <secret> ]
  13. [ password_file: <string> ]
  14. # Optional `Authorization` header configuration, required when role is
  15. # hcloud. Role robot does not support bearer token authentication.
  16. authorization:
  17. # Sets the authentication type.
  18. [ type: <string> | default: Bearer ]
  19. # Sets the credentials. It is mutually exclusive with
  20. # `credentials_file`.
  21. [ credentials: <secret> ]
  22. # Sets the credentials to the credentials read from the configured file.
  23. # It is mutually exclusive with `credentials`.
  24. [ credentials_file: <filename> ]
  25. # Optional OAuth 2.0 configuration.
  26. # Cannot be used at the same time as basic_auth or authorization.
  27. oauth2:
  28. [ <oauth2> ]
  29. # Optional proxy URL.
  30. [ proxy_url: <string> ]
  31. # Specifies headers to send to proxies during CONNECT requests.
  32. [ proxy_connect_headers:
  33. [ <string>: [<secret>, ...] ] ]
  34. # Configure whether HTTP requests follow HTTP 3xx redirects.
  35. [ follow_redirects: <boolean> | default = true ]
  36. # Whether to enable HTTP2.
  37. [ enable_http2: <bool> | default: true ]
  38. # TLS configuration.
  39. tls_config:
  40. [ <tls_config> ]
  41. # The port to scrape metrics from.
  42. [ port: <int> | default = 80 ]
  43. # The time after which the servers are refreshed.
  44. [ refresh_interval: <duration> | default = 60s ]

<http_sd_config>

HTTP-based service discovery provides a more generic way to configure static targets and serves as an interface to plug in custom service discovery mechanisms.

It fetches targets from an HTTP endpoint containing a list of zero or more <static_config>s. The target must reply with an HTTP 200 response. The HTTP header Content-Type must be application/json, and the body must be valid JSON.

Example response body:

  1. [
  2. {
  3. "targets": [ "<host>", ... ],
  4. "labels": {
  5. "<labelname>": "<labelvalue>", ...
  6. }
  7. },
  8. ...
  9. ]

The endpoint is queried periodically at the specified refresh interval. The prometheus_sd_http_failures_total counter metric tracks the number of refresh failures.

Each target has a meta label __meta_url during the relabeling phase. Its value is set to the URL from which the target was extracted.

  1. # URL from which the targets are fetched.
  2. url: <string>
  3. # Refresh interval to re-query the endpoint.
  4. [ refresh_interval: <duration> | default = 60s ]
  5. # Authentication information used to authenticate to the API server.
  6. # Note that `basic_auth`, `authorization` and `oauth2` options are
  7. # mutually exclusive.
  8. # `password` and `password_file` are mutually exclusive.
  9. # Optional HTTP basic authentication information.
  10. basic_auth:
  11. [ username: <string> ]
  12. [ password: <secret> ]
  13. [ password_file: <string> ]
  14. # Optional `Authorization` header configuration.
  15. authorization:
  16. # Sets the authentication type.
  17. [ type: <string> | default: Bearer ]
  18. # Sets the credentials. It is mutually exclusive with
  19. # `credentials_file`.
  20. [ credentials: <secret> ]
  21. # Sets the credentials to the credentials read from the configured file.
  22. # It is mutually exclusive with `credentials`.
  23. [ credentials_file: <filename> ]
  24. # Optional OAuth 2.0 configuration.
  25. oauth2:
  26. [ <oauth2> ]
  27. # Optional proxy URL.
  28. [ proxy_url: <string> ]
  29. # Specifies headers to send to proxies during CONNECT requests.
  30. [ proxy_connect_headers:
  31. [ <string>: [<secret>, ...] ] ]
  32. # Configure whether HTTP requests follow HTTP 3xx redirects.
  33. [ follow_redirects: <boolean> | default = true ]
  34. # Whether to enable HTTP2.
  35. [ enable_http2: <bool> | default: true ]
  36. # TLS configuration.
  37. tls_config:
  38. [ <tls_config> ]

<ionos_sd_config>

IONOS SD configurations allows retrieving scrape targets from IONOS Cloud API. This service discovery uses the first NICs IP address by default, but that can be changed with relabeling. The following meta labels are available on all targets during relabeling:

  • __meta_ionos_server_availability_zone: the availability zone of the server
  • __meta_ionos_server_boot_cdrom_id: the ID of the CD-ROM the server is booted from
  • __meta_ionos_server_boot_image_id: the ID of the boot image or snapshot the server is booted from
  • __meta_ionos_server_boot_volume_id: the ID of the boot volume
  • __meta_ionos_server_cpu_family: the CPU family of the server to
  • __meta_ionos_server_id: the ID of the server
  • __meta_ionos_server_ip: comma separated list of all IPs assigned to the server
  • __meta_ionos_server_lifecycle: the lifecycle state of the server resource
  • __meta_ionos_server_name: the name of the server
  • __meta_ionos_server_nic_ip_<nic_name>: comma separated list of IPs, grouped by the name of each NIC attached to the server
  • __meta_ionos_server_servers_id: the ID of the servers the server belongs to
  • __meta_ionos_server_state: the execution state of the server
  • __meta_ionos_server_type: the type of the server
  1. # The unique ID of the data center.
  2. datacenter_id: <string>
  3. # Authentication information used to authenticate to the API server.
  4. # Note that `basic_auth` and `authorization` options are
  5. # mutually exclusive.
  6. # password and password_file are mutually exclusive.
  7. # Optional HTTP basic authentication information, required when using IONOS
  8. # Cloud username and password as authentication method.
  9. basic_auth:
  10. [ username: <string> ]
  11. [ password: <secret> ]
  12. [ password_file: <string> ]
  13. # Optional `Authorization` header configuration, required when using IONOS
  14. # Cloud token as authentication method.
  15. authorization:
  16. # Sets the authentication type.
  17. [ type: <string> | default: Bearer ]
  18. # Sets the credentials. It is mutually exclusive with
  19. # `credentials_file`.
  20. [ credentials: <secret> ]
  21. # Sets the credentials to the credentials read from the configured file.
  22. # It is mutually exclusive with `credentials`.
  23. [ credentials_file: <filename> ]
  24. # Optional OAuth 2.0 configuration.
  25. # Cannot be used at the same time as basic_auth or authorization.
  26. oauth2:
  27. [ <oauth2> ]
  28. # Optional proxy URL.
  29. [ proxy_url: <string> ]
  30. # Specifies headers to send to proxies during CONNECT requests.
  31. [ proxy_connect_headers:
  32. [ <string>: [<secret>, ...] ] ]
  33. # Configure whether HTTP requests follow HTTP 3xx redirects.
  34. [ follow_redirects: <boolean> | default = true ]
  35. # Whether to enable HTTP2.
  36. [ enable_http2: <bool> | default: true ]
  37. # TLS configuration.
  38. tls_config:
  39. [ <tls_config> ]
  40. # The port to scrape metrics from.
  41. [ port: <int> | default = 80 ]
  42. # The time after which the servers are refreshed.
  43. [ refresh_interval: <duration> | default = 60s ]

<kubernetes_sd_config>

Kubernetes SD configurations allow retrieving scrape targets from Kubernetes’ REST API and always staying synchronized with the cluster state.

One of the following role types can be configured to discover targets:

node

The node role discovers one target per cluster node with the address defaulting to the Kubelet’s HTTP port. The target address defaults to the first existing address of the Kubernetes node object in the address type order of NodeInternalIP, NodeExternalIP, NodeLegacyHostIP, and NodeHostName.

Available meta labels:

  • __meta_kubernetes_node_name: The name of the node object.
  • __meta_kubernetes_node_provider_id: The cloud provider’s name for the node object.
  • __meta_kubernetes_node_label_<labelname>: Each label from the node object.
  • __meta_kubernetes_node_labelpresent_<labelname>: true for each label from the node object.
  • __meta_kubernetes_node_annotation_<annotationname>: Each annotation from the node object.
  • __meta_kubernetes_node_annotationpresent_<annotationname>: true for each annotation from the node object.
  • __meta_kubernetes_node_address_<address_type>: The first address for each node address type, if it exists.

In addition, the instance label for the node will be set to the node name as retrieved from the API server.

service

The service role discovers a target for each service port for each service. This is generally useful for blackbox monitoring of a service. The address will be set to the Kubernetes DNS name of the service and respective service port.

Available meta labels:

  • __meta_kubernetes_namespace: The namespace of the service object.
  • __meta_kubernetes_service_annotation_<annotationname>: Each annotation from the service object.
  • __meta_kubernetes_service_annotationpresent_<annotationname>: “true” for each annotation of the service object.
  • __meta_kubernetes_service_cluster_ip: The cluster IP address of the service. (Does not apply to services of type ExternalName)
  • __meta_kubernetes_service_loadbalancer_ip: The IP address of the loadbalancer. (Applies to services of type LoadBalancer)
  • __meta_kubernetes_service_external_name: The DNS name of the service. (Applies to services of type ExternalName)
  • __meta_kubernetes_service_label_<labelname>: Each label from the service object.
  • __meta_kubernetes_service_labelpresent_<labelname>: true for each label of the service object.
  • __meta_kubernetes_service_name: The name of the service object.
  • __meta_kubernetes_service_port_name: Name of the service port for the target.
  • __meta_kubernetes_service_port_number: Number of the service port for the target.
  • __meta_kubernetes_service_port_protocol: Protocol of the service port for the target.
  • __meta_kubernetes_service_type: The type of the service.

pod

The pod role discovers all pods and exposes their containers as targets. For each declared port of a container, a single target is generated. If a container has no specified ports, a port-free target per container is created for manually adding a port via relabeling.

Available meta labels:

  • __meta_kubernetes_namespace: The namespace of the pod object.
  • __meta_kubernetes_pod_name: The name of the pod object.
  • __meta_kubernetes_pod_ip: The pod IP of the pod object.
  • __meta_kubernetes_pod_label_<labelname>: Each label from the pod object.
  • __meta_kubernetes_pod_labelpresent_<labelname>: true for each label from the pod object.
  • __meta_kubernetes_pod_annotation_<annotationname>: Each annotation from the pod object.
  • __meta_kubernetes_pod_annotationpresent_<annotationname>: true for each annotation from the pod object.
  • __meta_kubernetes_pod_container_init: true if the container is an InitContainer
  • __meta_kubernetes_pod_container_name: Name of the container the target address points to.
  • __meta_kubernetes_pod_container_image: The image the container is using.
  • __meta_kubernetes_pod_container_port_name: Name of the container port.
  • __meta_kubernetes_pod_container_port_number: Number of the container port.
  • __meta_kubernetes_pod_container_port_protocol: Protocol of the container port.
  • __meta_kubernetes_pod_ready: Set to true or false for the pod’s ready state.
  • __meta_kubernetes_pod_phase: Set to Pending, Running, Succeeded, Failed or Unknown in the lifecycle.
  • __meta_kubernetes_pod_node_name: The name of the node the pod is scheduled onto.
  • __meta_kubernetes_pod_host_ip: The current host IP of the pod object.
  • __meta_kubernetes_pod_uid: The UID of the pod object.
  • __meta_kubernetes_pod_controller_kind: Object kind of the pod controller.
  • __meta_kubernetes_pod_controller_name: Name of the pod controller.

endpoints

The endpoints role discovers targets from listed endpoints of a service. For each endpoint address one target is discovered per port. If the endpoint is backed by a pod, all additional container ports of the pod, not bound to an endpoint port, are discovered as targets as well.

Available meta labels:

  • __meta_kubernetes_namespace: The namespace of the endpoints object.
  • __meta_kubernetes_endpoints_name: The names of the endpoints object.
  • __meta_kubernetes_endpoints_label_<labelname>: Each label from the endpoints object.
  • __meta_kubernetes_endpoints_labelpresent_<labelname>: true for each label from the endpoints object.
  • For all targets discovered directly from the endpoints list (those not additionally inferred from underlying pods), the following labels are attached:
    • __meta_kubernetes_endpoint_hostname: Hostname of the endpoint.
    • __meta_kubernetes_endpoint_node_name: Name of the node hosting the endpoint.
    • __meta_kubernetes_endpoint_ready: Set to true or false for the endpoint’s ready state.
    • __meta_kubernetes_endpoint_port_name: Name of the endpoint port.
    • __meta_kubernetes_endpoint_port_protocol: Protocol of the endpoint port.
    • __meta_kubernetes_endpoint_address_target_kind: Kind of the endpoint address target.
    • __meta_kubernetes_endpoint_address_target_name: Name of the endpoint address target.
  • If the endpoints belong to a service, all labels of the role: service discovery are attached.
  • For all targets backed by a pod, all labels of the role: pod discovery are attached.

endpointslice

The endpointslice role discovers targets from existing endpointslices. For each endpoint address referenced in the endpointslice object one target is discovered. If the endpoint is backed by a pod, all additional container ports of the pod, not bound to an endpoint port, are discovered as targets as well.

Available meta labels:

  • __meta_kubernetes_namespace: The namespace of the endpoints object.
  • __meta_kubernetes_endpointslice_name: The name of endpointslice object.
  • For all targets discovered directly from the endpointslice list (those not additionally inferred from underlying pods), the following labels are attached:
    • __meta_kubernetes_endpointslice_address_target_kind: Kind of the referenced object.
    • __meta_kubernetes_endpointslice_address_target_name: Name of referenced object.
    • __meta_kubernetes_endpointslice_address_type: The ip protocol family of the address of the target.
    • __meta_kubernetes_endpointslice_endpoint_conditions_ready: Set to true or false for the referenced endpoint’s ready state.
    • __meta_kubernetes_endpointslice_endpoint_topology_kubernetes_io_hostname: Name of the node hosting the referenced endpoint.
    • __meta_kubernetes_endpointslice_endpoint_topology_present_kubernetes_io_hostname: Flag that shows if the referenced object has a kubernetes.io/hostname annotation.
    • __meta_kubernetes_endpointslice_port: Port of the referenced endpoint.
    • __meta_kubernetes_endpointslice_port_name: Named port of the referenced endpoint.
    • __meta_kubernetes_endpointslice_port_protocol: Protocol of the referenced endpoint.
  • If the endpoints belong to a service, all labels of the role: service discovery are attached.
  • For all targets backed by a pod, all labels of the role: pod discovery are attached.

ingress

The ingress role discovers a target for each path of each ingress. This is generally useful for blackbox monitoring of an ingress. The address will be set to the host specified in the ingress spec.

Available meta labels:

  • __meta_kubernetes_namespace: The namespace of the ingress object.
  • __meta_kubernetes_ingress_name: The name of the ingress object.
  • __meta_kubernetes_ingress_label_<labelname>: Each label from the ingress object.
  • __meta_kubernetes_ingress_labelpresent_<labelname>: true for each label from the ingress object.
  • __meta_kubernetes_ingress_annotation_<annotationname>: Each annotation from the ingress object.
  • __meta_kubernetes_ingress_annotationpresent_<annotationname>: true for each annotation from the ingress object.
  • __meta_kubernetes_ingress_class_name: Class name from ingress spec, if present.
  • __meta_kubernetes_ingress_scheme: Protocol scheme of ingress, https if TLS config is set. Defaults to http.
  • __meta_kubernetes_ingress_path: Path from ingress spec. Defaults to /.

See below for the configuration options for Kubernetes discovery:

  1. # The information to access the Kubernetes API.
  2. # The API server addresses. If left empty, Prometheus is assumed to run inside
  3. # of the cluster and will discover API servers automatically and use the pod's
  4. # CA certificate and bearer token file at /var/run/secrets/kubernetes.io/serviceaccount/.
  5. [ api_server: <host> ]
  6. # The Kubernetes role of entities that should be discovered.
  7. # One of endpoints, endpointslice, service, pod, node, or ingress.
  8. role: <string>
  9. # Optional path to a kubeconfig file.
  10. # Note that api_server and kube_config are mutually exclusive.
  11. [ kubeconfig_file: <filename> ]
  12. # Optional authentication information used to authenticate to the API server.
  13. # Note that `basic_auth` and `authorization` options are mutually exclusive.
  14. # password and password_file are mutually exclusive.
  15. # Optional HTTP basic authentication information.
  16. basic_auth:
  17. [ username: <string> ]
  18. [ password: <secret> ]
  19. [ password_file: <string> ]
  20. # Optional `Authorization` header configuration.
  21. authorization:
  22. # Sets the authentication type.
  23. [ type: <string> | default: Bearer ]
  24. # Sets the credentials. It is mutually exclusive with
  25. # `credentials_file`.
  26. [ credentials: <secret> ]
  27. # Sets the credentials to the credentials read from the configured file.
  28. # It is mutually exclusive with `credentials`.
  29. [ credentials_file: <filename> ]
  30. # Optional OAuth 2.0 configuration.
  31. # Cannot be used at the same time as basic_auth or authorization.
  32. oauth2:
  33. [ <oauth2> ]
  34. # Optional proxy URL.
  35. [ proxy_url: <string> ]
  36. # Specifies headers to send to proxies during CONNECT requests.
  37. [ proxy_connect_headers:
  38. [ <string>: [<secret>, ...] ] ]
  39. # Configure whether HTTP requests follow HTTP 3xx redirects.
  40. [ follow_redirects: <boolean> | default = true ]
  41. # Whether to enable HTTP2.
  42. [ enable_http2: <bool> | default: true ]
  43. # TLS configuration.
  44. tls_config:
  45. [ <tls_config> ]
  46. # Optional namespace discovery. If omitted, all namespaces are used.
  47. namespaces:
  48. own_namespace: <boolean>
  49. names:
  50. [ - <string> ]
  51. # Optional label and field selectors to limit the discovery process to a subset of available resources.
  52. # See https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/
  53. # and https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ to learn more about the possible
  54. # filters that can be used. The endpoints role supports pod, service and endpoints selectors.
  55. # The pod role supports node selectors when configured with `attach_metadata: {node: true}`.
  56. # Other roles only support selectors matching the role itself (e.g. node role can only contain node selectors).
  57. # Note: When making decision about using field/label selector make sure that this
  58. # is the best approach - it will prevent Prometheus from reusing single list/watch
  59. # for all scrape configs. This might result in a bigger load on the Kubernetes API,
  60. # because per each selector combination there will be additional LIST/WATCH. On the other hand,
  61. # if you just want to monitor small subset of pods in large cluster it's recommended to use selectors.
  62. # Decision, if selectors should be used or not depends on the particular situation.
  63. [ selectors:
  64. [ - role: <string>
  65. [ label: <string> ]
  66. [ field: <string> ] ]]
  67. # Optional metadata to attach to discovered targets. If omitted, no additional metadata is attached.
  68. attach_metadata:
  69. # Attaches node metadata to discovered targets. Valid for roles: pod, endpoints, endpointslice.
  70. # When set to true, Prometheus must have permissions to get Nodes.
  71. [ node: <boolean> | default = false ]

See this example Prometheus configuration file for a detailed example of configuring Prometheus for Kubernetes.

You may wish to check out the 3rd party Prometheus Operator, which automates the Prometheus setup on top of Kubernetes.

<kuma_sd_config>

Kuma SD configurations allow retrieving scrape target from the Kuma control plane.

This SD discovers “monitoring assignments” based on Kuma Dataplane Proxies, via the MADS v1 (Monitoring Assignment Discovery Service) xDS API, and will create a target for each proxy inside a Prometheus-enabled mesh.

The following meta labels are available for each target:

  • __meta_kuma_mesh: the name of the proxy’s Mesh
  • __meta_kuma_dataplane: the name of the proxy
  • __meta_kuma_service: the name of the proxy’s associated Service
  • __meta_kuma_label_<tagname>: each tag of the proxy

See below for the configuration options for Kuma MonitoringAssignment discovery:

  1. # Address of the Kuma Control Plane's MADS xDS server.
  2. server: <string>
  3. # The time to wait between polling update requests.
  4. [ refresh_interval: <duration> | default = 30s ]
  5. # The time after which the monitoring assignments are refreshed.
  6. [ fetch_timeout: <duration> | default = 2m ]
  7. # Optional proxy URL.
  8. [ proxy_url: <string> ]
  9. # Specifies headers to send to proxies during CONNECT requests.
  10. [ proxy_connect_headers:
  11. [ <string>: [<secret>, ...] ] ]
  12. # TLS configuration.
  13. tls_config:
  14. [ <tls_config> ]
  15. # Authentication information used to authenticate to the Docker daemon.
  16. # Note that `basic_auth` and `authorization` options are
  17. # mutually exclusive.
  18. # password and password_file are mutually exclusive.
  19. # Optional HTTP basic authentication information.
  20. basic_auth:
  21. [ username: <string> ]
  22. [ password: <secret> ]
  23. [ password_file: <string> ]
  24. # Optional the `Authorization` header configuration.
  25. authorization:
  26. # Sets the authentication type.
  27. [ type: <string> | default: Bearer ]
  28. # Sets the credentials. It is mutually exclusive with
  29. # `credentials_file`.
  30. [ credentials: <secret> ]
  31. # Sets the credentials with the credentials read from the configured file.
  32. # It is mutually exclusive with `credentials`.
  33. [ credentials_file: <filename> ]
  34. # Optional OAuth 2.0 configuration.
  35. # Cannot be used at the same time as basic_auth or authorization.
  36. oauth2:
  37. [ <oauth2> ]
  38. # Configure whether HTTP requests follow HTTP 3xx redirects.
  39. [ follow_redirects: <boolean> | default = true ]
  40. # Whether to enable HTTP2.
  41. [ enable_http2: <bool> | default: true ]

The relabeling phase is the preferred and more powerful way to filter proxies and user-defined tags.

<lightsail_sd_config>

Lightsail SD configurations allow retrieving scrape targets from AWS Lightsail instances. The private IP address is used by default, but may be changed to the public IP address with relabeling.

The following meta labels are available on targets during relabeling:

  • __meta_lightsail_availability_zone: the availability zone in which the instance is running
  • __meta_lightsail_blueprint_id: the Lightsail blueprint ID
  • __meta_lightsail_bundle_id: the Lightsail bundle ID
  • __meta_lightsail_instance_name: the name of the Lightsail instance
  • __meta_lightsail_instance_state: the state of the Lightsail instance
  • __meta_lightsail_instance_support_code: the support code of the Lightsail instance
  • __meta_lightsail_ipv6_addresses: comma separated list of IPv6 addresses assigned to the instance’s network interfaces, if present
  • __meta_lightsail_private_ip: the private IP address of the instance
  • __meta_lightsail_public_ip: the public IP address of the instance, if available
  • __meta_lightsail_region: the region of the instance
  • __meta_lightsail_tag_<tagkey>: each tag value of the instance

See below for the configuration options for Lightsail discovery:

  1. # The information to access the Lightsail API.
  2. # The AWS region. If blank, the region from the instance metadata is used.
  3. [ region: <string> ]
  4. # Custom endpoint to be used.
  5. [ endpoint: <string> ]
  6. # The AWS API keys. If blank, the environment variables `AWS_ACCESS_KEY_ID`
  7. # and `AWS_SECRET_ACCESS_KEY` are used.
  8. [ access_key: <string> ]
  9. [ secret_key: <secret> ]
  10. # Named AWS profile used to connect to the API.
  11. [ profile: <string> ]
  12. # AWS Role ARN, an alternative to using AWS API keys.
  13. [ role_arn: <string> ]
  14. # Refresh interval to re-read the instance list.
  15. [ refresh_interval: <duration> | default = 60s ]
  16. # The port to scrape metrics from. If using the public IP address, this must
  17. # instead be specified in the relabeling rule.
  18. [ port: <int> | default = 80 ]
  19. # Authentication information used to authenticate to the Lightsail API.
  20. # Note that `basic_auth`, `authorization` and `oauth2` options are
  21. # mutually exclusive.
  22. # `password` and `password_file` are mutually exclusive.
  23. # Optional HTTP basic authentication information, currently not supported by AWS.
  24. basic_auth:
  25. [ username: <string> ]
  26. [ password: <secret> ]
  27. [ password_file: <string> ]
  28. # Optional `Authorization` header configuration, currently not supported by AWS.
  29. authorization:
  30. # Sets the authentication type.
  31. [ type: <string> | default: Bearer ]
  32. # Sets the credentials. It is mutually exclusive with
  33. # `credentials_file`.
  34. [ credentials: <secret> ]
  35. # Sets the credentials to the credentials read from the configured file.
  36. # It is mutuall exclusive with `credentials`.
  37. [ credentials_file: <filename> ]
  38. # Optional OAuth 2.0 configuration, currently not supported by AWS.
  39. oauth2:
  40. [ <oauth2> ]
  41. # Optional proxy URL.
  42. [ proxy_url: <string> ]
  43. # Specifies headers to send to proxies during CONNECT requests.
  44. [ proxy_connect_headers:
  45. [ <string>: [<secret>, ...] ] ]
  46. # Configure whether HTTP requests follow HTTP 3xx redirects.
  47. [ follow_redirects: <boolean> | default = true ]
  48. # Whether to enable HTTP2.
  49. [ enable_http2: <bool> | default: true ]
  50. # TLS configuration.
  51. tls_config:
  52. [ <tls_config> ]

<linode_sd_config>

Linode SD configurations allow retrieving scrape targets from Linode’s Linode APIv4. This service discovery uses the public IPv4 address by default, by that can be changed with relabeling, as demonstrated in the Prometheus linode-sd configuration file.

The following meta labels are available on targets during relabeling:

  • __meta_linode_instance_id: the id of the linode instance
  • __meta_linode_instance_label: the label of the linode instance
  • __meta_linode_image: the slug of the linode instance’s image
  • __meta_linode_private_ipv4: the private IPv4 of the linode instance
  • __meta_linode_public_ipv4: the public IPv4 of the linode instance
  • __meta_linode_public_ipv6: the public IPv6 of the linode instance
  • __meta_linode_region: the region of the linode instance
  • __meta_linode_type: the type of the linode instance
  • __meta_linode_status: the status of the linode instance
  • __meta_linode_tags: a list of tags of the linode instance joined by the tag separator
  • __meta_linode_group: the display group a linode instance is a member of
  • __meta_linode_hypervisor: the virtualization software powering the linode instance
  • __meta_linode_backups: the backup service status of the linode instance
  • __meta_linode_specs_disk_bytes: the amount of storage space the linode instance has access to
  • __meta_linode_specs_memory_bytes: the amount of RAM the linode instance has access to
  • __meta_linode_specs_vcpus: the number of VCPUS this linode has access to
  • __meta_linode_specs_transfer_bytes: the amount of network transfer the linode instance is allotted each month
  • __meta_linode_extra_ips: a list of all extra IPv4 addresses assigned to the linode instance joined by the tag separator
  1. # Authentication information used to authenticate to the API server.
  2. # Note that `basic_auth` and `authorization` options are
  3. # mutually exclusive.
  4. # password and password_file are mutually exclusive.
  5. # Note: Linode APIv4 Token must be created with scopes: 'linodes:read_only', 'ips:read_only', and 'events:read_only'
  6. # Optional HTTP basic authentication information, not currently supported by Linode APIv4.
  7. basic_auth:
  8. [ username: <string> ]
  9. [ password: <secret> ]
  10. [ password_file: <string> ]
  11. # Optional the `Authorization` header configuration.
  12. authorization:
  13. # Sets the authentication type.
  14. [ type: <string> | default: Bearer ]
  15. # Sets the credentials. It is mutually exclusive with
  16. # `credentials_file`.
  17. [ credentials: <secret> ]
  18. # Sets the credentials with the credentials read from the configured file.
  19. # It is mutually exclusive with `credentials`.
  20. [ credentials_file: <filename> ]
  21. # Optional OAuth 2.0 configuration.
  22. # Cannot be used at the same time as basic_auth or authorization.
  23. oauth2:
  24. [ <oauth2> ]
  25. # Optional proxy URL.
  26. [ proxy_url: <string> ]
  27. # Specifies headers to send to proxies during CONNECT requests.
  28. [ proxy_connect_headers:
  29. [ <string>: [<secret>, ...] ] ]
  30. # Configure whether HTTP requests follow HTTP 3xx redirects.
  31. [ follow_redirects: <boolean> | default = true ]
  32. # Whether to enable HTTP2.
  33. [ enable_http2: <bool> | default: true ]
  34. # TLS configuration.
  35. tls_config:
  36. [ <tls_config> ]
  37. # The port to scrape metrics from.
  38. [ port: <int> | default = 80 ]
  39. # The string by which Linode Instance tags are joined into the tag label.
  40. [ tag_separator: <string> | default = , ]
  41. # The time after which the linode instances are refreshed.
  42. [ refresh_interval: <duration> | default = 60s ]

<marathon_sd_config>

Marathon SD configurations allow retrieving scrape targets using the Marathon REST API. Prometheus will periodically check the REST endpoint for currently running tasks and create a target group for every app that has at least one healthy task.

The following meta labels are available on targets during relabeling:

  • __meta_marathon_app: the name of the app (with slashes replaced by dashes)
  • __meta_marathon_image: the name of the Docker image used (if available)
  • __meta_marathon_task: the ID of the Mesos task
  • __meta_marathon_app_label_<labelname>: any Marathon labels attached to the app
  • __meta_marathon_port_definition_label_<labelname>: the port definition labels
  • __meta_marathon_port_mapping_label_<labelname>: the port mapping labels
  • __meta_marathon_port_index: the port index number (e.g. 1 for PORT1)

See below for the configuration options for Marathon discovery:

  1. # List of URLs to be used to contact Marathon servers.
  2. # You need to provide at least one server URL.
  3. servers:
  4. - <string>
  5. # Polling interval
  6. [ refresh_interval: <duration> | default = 30s ]
  7. # Optional authentication information for token-based authentication
  8. # https://docs.mesosphere.com/1.11/security/ent/iam-api/#passing-an-authentication-token
  9. # It is mutually exclusive with `auth_token_file` and other authentication mechanisms.
  10. [ auth_token: <secret> ]
  11. # Optional authentication information for token-based authentication
  12. # https://docs.mesosphere.com/1.11/security/ent/iam-api/#passing-an-authentication-token
  13. # It is mutually exclusive with `auth_token` and other authentication mechanisms.
  14. [ auth_token_file: <filename> ]
  15. # Sets the `Authorization` header on every request with the
  16. # configured username and password.
  17. # This is mutually exclusive with other authentication mechanisms.
  18. # password and password_file are mutually exclusive.
  19. basic_auth:
  20. [ username: <string> ]
  21. [ password: <secret> ]
  22. [ password_file: <string> ]
  23. # Optional `Authorization` header configuration.
  24. # NOTE: The current version of DC/OS marathon (v1.11.0) does not support
  25. # standard `Authentication` header, use `auth_token` or `auth_token_file`
  26. # instead.
  27. authorization:
  28. # Sets the authentication type.
  29. [ type: <string> | default: Bearer ]
  30. # Sets the credentials. It is mutually exclusive with
  31. # `credentials_file`.
  32. [ credentials: <secret> ]
  33. # Sets the credentials to the credentials read from the configured file.
  34. # It is mutually exclusive with `credentials`.
  35. [ credentials_file: <filename> ]
  36. # Optional OAuth 2.0 configuration.
  37. # Cannot be used at the same time as basic_auth or authorization.
  38. oauth2:
  39. [ <oauth2> ]
  40. # Configure whether HTTP requests follow HTTP 3xx redirects.
  41. [ follow_redirects: <boolean> | default = true ]
  42. # Whether to enable HTTP2.
  43. [ enable_http2: <bool> | default: true ]
  44. # TLS configuration for connecting to marathon servers
  45. tls_config:
  46. [ <tls_config> ]
  47. # Optional proxy URL.
  48. [ proxy_url: <string> ]
  49. # Specifies headers to send to proxies during CONNECT requests.
  50. [ proxy_connect_headers:
  51. [ <string>: [<secret>, ...] ] ]

By default every app listed in Marathon will be scraped by Prometheus. If not all of your services provide Prometheus metrics, you can use a Marathon label and Prometheus relabeling to control which instances will actually be scraped. See the Prometheus marathon-sd configuration file for a practical example on how to set up your Marathon app and your Prometheus configuration.

By default, all apps will show up as a single job in Prometheus (the one specified in the configuration file), which can also be changed using relabeling.

<nerve_sd_config>

Nerve SD configurations allow retrieving scrape targets from AirBnB’s Nerve which are stored in Zookeeper.

The following meta labels are available on targets during relabeling:

  • __meta_nerve_path: the full path to the endpoint node in Zookeeper
  • __meta_nerve_endpoint_host: the host of the endpoint
  • __meta_nerve_endpoint_port: the port of the endpoint
  • __meta_nerve_endpoint_name: the name of the endpoint
  1. # The Zookeeper servers.
  2. servers:
  3. - <host>
  4. # Paths can point to a single service, or the root of a tree of services.
  5. paths:
  6. - <string>
  7. [ timeout: <duration> | default = 10s ]

<nomad_sd_config>

Nomad SD configurations allow retrieving scrape targets from Nomad’s Service API.

The following meta labels are available on targets during relabeling:

  • __meta_nomad_address: the service address of the target
  • __meta_nomad_dc: the datacenter name for the target
  • __meta_nomad_namespace: the namespace of the target
  • __meta_nomad_node_id: the node name defined for the target
  • __meta_nomad_service: the name of the service the target belongs to
  • __meta_nomad_service_address: the service address of the target
  • __meta_nomad_service_id: the service ID of the target
  • __meta_nomad_service_port: the service port of the target
  • __meta_nomad_tags: the list of tags of the target joined by the tag separator
  1. # The information to access the Nomad API. It is to be defined
  2. # as the Nomad documentation requires.
  3. [ allow_stale: <boolean> | default = true ]
  4. [ datacenter: <string> ]
  5. [ namespace: <string> | default = default ]
  6. [ refresh_interval: <duration> | default = 60s ]
  7. [ region: <string> | default = global ]
  8. [ server: <host> ]
  9. [ tag_separator: <string> | default = ,]
  10. # Authentication information used to authenticate to the nomad server.
  11. # Note that `basic_auth`, `authorization` and `oauth2` options are
  12. # mutually exclusive.
  13. # `password` and `password_file` are mutually exclusive.
  14. # Optional HTTP basic authentication information.
  15. basic_auth:
  16. [ username: <string> ]
  17. [ password: <secret> ]
  18. [ password_file: <string> ]
  19. # Optional `Authorization` header configuration.
  20. authorization:
  21. # Sets the authentication type.
  22. [ type: <string> | default: Bearer ]
  23. # Sets the credentials. It is mutually exclusive with
  24. # `credentials_file`.
  25. [ credentials: <secret> ]
  26. # Sets the credentials to the credentials read from the configured file.
  27. # It is mutually exclusive with `credentials`.
  28. [ credentials_file: <filename> ]
  29. # Optional OAuth 2.0 configuration.
  30. oauth2:
  31. [ <oauth2> ]
  32. # Optional proxy URL.
  33. [ proxy_url: <string> ]
  34. # Specifies headers to send to proxies during CONNECT requests.
  35. [ proxy_connect_headers:
  36. [ <string>: [<secret>, ...] ] ]
  37. # Configure whether HTTP requests follow HTTP 3xx redirects.
  38. [ follow_redirects: <boolean> | default = true ]
  39. # Whether to enable HTTP2.
  40. [ enable_http2: <bool> | default: true ]
  41. # TLS configuration.
  42. tls_config:
  43. [ <tls_config> ]

<serverset_sd_config>

Serverset SD configurations allow retrieving scrape targets from Serversets which are stored in Zookeeper. Serversets are commonly used by Finagle and Aurora.

The following meta labels are available on targets during relabeling:

  • __meta_serverset_path: the full path to the serverset member node in Zookeeper
  • __meta_serverset_endpoint_host: the host of the default endpoint
  • __meta_serverset_endpoint_port: the port of the default endpoint
  • __meta_serverset_endpoint_host_<endpoint>: the host of the given endpoint
  • __meta_serverset_endpoint_port_<endpoint>: the port of the given endpoint
  • __meta_serverset_shard: the shard number of the member
  • __meta_serverset_status: the status of the member
  1. # The Zookeeper servers.
  2. servers:
  3. - <host>
  4. # Paths can point to a single serverset, or the root of a tree of serversets.
  5. paths:
  6. - <string>
  7. [ timeout: <duration> | default = 10s ]

Serverset data must be in the JSON format, the Thrift format is not currently supported.

<triton_sd_config>

Triton SD configurations allow retrieving scrape targets from Container Monitor discovery endpoints.

One of the following <triton_role> types can be configured to discover targets:

container

The container role discovers one target per “virtual machine” owned by the account. These are SmartOS zones or lx/KVM/bhyve branded zones.

The following meta labels are available on targets during relabeling:

  • __meta_triton_groups: the list of groups belonging to the target joined by a comma separator
  • __meta_triton_machine_alias: the alias of the target container
  • __meta_triton_machine_brand: the brand of the target container
  • __meta_triton_machine_id: the UUID of the target container
  • __meta_triton_machine_image: the target container’s image type
  • __meta_triton_server_id: the server UUID the target container is running on

cn

The cn role discovers one target for per compute node (also known as “server” or “global zone”) making up the Triton infrastructure. The account must be a Triton operator and is currently required to own at least one container.

The following meta labels are available on targets during relabeling:

  • __meta_triton_machine_alias: the hostname of the target (requires triton-cmon 1.7.0 or newer)
  • __meta_triton_machine_id: the UUID of the target

See below for the configuration options for Triton discovery:

  1. # The information to access the Triton discovery API.
  2. # The account to use for discovering new targets.
  3. account: <string>
  4. # The type of targets to discover, can be set to:
  5. # * "container" to discover virtual machines (SmartOS zones, lx/KVM/bhyve branded zones) running on Triton
  6. # * "cn" to discover compute nodes (servers/global zones) making up the Triton infrastructure
  7. [ role : <string> | default = "container" ]
  8. # The DNS suffix which should be applied to target.
  9. dns_suffix: <string>
  10. # The Triton discovery endpoint (e.g. 'cmon.us-east-3b.triton.zone'). This is
  11. # often the same value as dns_suffix.
  12. endpoint: <string>
  13. # A list of groups for which targets are retrieved, only supported when `role` == `container`.
  14. # If omitted all containers owned by the requesting account are scraped.
  15. groups:
  16. [ - <string> ... ]
  17. # The port to use for discovery and metric scraping.
  18. [ port: <int> | default = 9163 ]
  19. # The interval which should be used for refreshing targets.
  20. [ refresh_interval: <duration> | default = 60s ]
  21. # The Triton discovery API version.
  22. [ version: <int> | default = 1 ]
  23. # TLS configuration.
  24. tls_config:
  25. [ <tls_config> ]

<eureka_sd_config>

Eureka SD configurations allow retrieving scrape targets using the Eureka REST API. Prometheus will periodically check the REST endpoint and create a target for every app instance.

The following meta labels are available on targets during relabeling:

  • __meta_eureka_app_name: the name of the app
  • __meta_eureka_app_instance_id: the ID of the app instance
  • __meta_eureka_app_instance_hostname: the hostname of the instance
  • __meta_eureka_app_instance_homepage_url: the homepage url of the app instance
  • __meta_eureka_app_instance_statuspage_url: the status page url of the app instance
  • __meta_eureka_app_instance_healthcheck_url: the health check url of the app instance
  • __meta_eureka_app_instance_ip_addr: the IP address of the app instance
  • __meta_eureka_app_instance_vip_address: the VIP address of the app instance
  • __meta_eureka_app_instance_secure_vip_address: the secure VIP address of the app instance
  • __meta_eureka_app_instance_status: the status of the app instance
  • __meta_eureka_app_instance_port: the port of the app instance
  • __meta_eureka_app_instance_port_enabled: the port enabled of the app instance
  • __meta_eureka_app_instance_secure_port: the secure port address of the app instance
  • __meta_eureka_app_instance_secure_port_enabled: the secure port of the app instance
  • __meta_eureka_app_instance_country_id: the country ID of the app instance
  • __meta_eureka_app_instance_metadata_<metadataname>: app instance metadata
  • __meta_eureka_app_instance_datacenterinfo_name: the datacenter name of the app instance
  • __meta_eureka_app_instance_datacenterinfo_<metadataname>: the datacenter metadata

See below for the configuration options for Eureka discovery:

  1. # The URL to connect to the Eureka server.
  2. server: <string>
  3. # Sets the `Authorization` header on every request with the
  4. # configured username and password.
  5. # password and password_file are mutually exclusive.
  6. basic_auth:
  7. [ username: <string> ]
  8. [ password: <secret> ]
  9. [ password_file: <string> ]
  10. # Optional `Authorization` header configuration.
  11. authorization:
  12. # Sets the authentication type.
  13. [ type: <string> | default: Bearer ]
  14. # Sets the credentials. It is mutually exclusive with
  15. # `credentials_file`.
  16. [ credentials: <secret> ]
  17. # Sets the credentials to the credentials read from the configured file.
  18. # It is mutually exclusive with `credentials`.
  19. [ credentials_file: <filename> ]
  20. # Optional OAuth 2.0 configuration.
  21. # Cannot be used at the same time as basic_auth or authorization.
  22. oauth2:
  23. [ <oauth2> ]
  24. # Configures the scrape request's TLS settings.
  25. tls_config:
  26. [ <tls_config> ]
  27. # Optional proxy URL.
  28. [ proxy_url: <string> ]
  29. # Specifies headers to send to proxies during CONNECT requests.
  30. [ proxy_connect_headers:
  31. [ <string>: [<secret>, ...] ] ]
  32. # Configure whether HTTP requests follow HTTP 3xx redirects.
  33. [ follow_redirects: <boolean> | default = true ]
  34. # Whether to enable HTTP2.
  35. [ enable_http2: <bool> | default: true ]
  36. # Refresh interval to re-read the app instance list.
  37. [ refresh_interval: <duration> | default = 30s ]

See the Prometheus eureka-sd configuration file for a practical example on how to set up your Eureka app and your Prometheus configuration.

<scaleway_sd_config>

Scaleway SD configurations allow retrieving scrape targets from Scaleway instances and baremetal services.

The following meta labels are available on targets during relabeling:

Instance role

  • __meta_scaleway_instance_boot_type: the boot type of the server
  • __meta_scaleway_instance_hostname: the hostname of the server
  • __meta_scaleway_instance_id: the ID of the server
  • __meta_scaleway_instance_image_arch: the arch of the server image
  • __meta_scaleway_instance_image_id: the ID of the server image
  • __meta_scaleway_instance_image_name: the name of the server image
  • __meta_scaleway_instance_location_cluster_id: the cluster ID of the server location
  • __meta_scaleway_instance_location_hypervisor_id: the hypervisor ID of the server location
  • __meta_scaleway_instance_location_node_id: the node ID of the server location
  • __meta_scaleway_instance_name: name of the server
  • __meta_scaleway_instance_organization_id: the organization of the server
  • __meta_scaleway_instance_private_ipv4: the private IPv4 address of the server
  • __meta_scaleway_instance_project_id: project id of the server
  • __meta_scaleway_instance_public_ipv4: the public IPv4 address of the server
  • __meta_scaleway_instance_public_ipv6: the public IPv6 address of the server
  • __meta_scaleway_instance_region: the region of the server
  • __meta_scaleway_instance_security_group_id: the ID of the security group of the server
  • __meta_scaleway_instance_security_group_name: the name of the security group of the server
  • __meta_scaleway_instance_status: status of the server
  • __meta_scaleway_instance_tags: the list of tags of the server joined by the tag separator
  • __meta_scaleway_instance_type: commercial type of the server
  • __meta_scaleway_instance_zone: the zone of the server (ex: fr-par-1, complete list here)

This role uses the private IPv4 address by default. This can be changed with relabeling, as demonstrated in the Prometheus scaleway-sd configuration file.

Baremetal role

  • __meta_scaleway_baremetal_id: the ID of the server
  • __meta_scaleway_baremetal_public_ipv4: the public IPv4 address of the server
  • __meta_scaleway_baremetal_public_ipv6: the public IPv6 address of the server
  • __meta_scaleway_baremetal_name: the name of the server
  • __meta_scaleway_baremetal_os_name: the name of the operating system of the server
  • __meta_scaleway_baremetal_os_version: the version of the operating system of the server
  • __meta_scaleway_baremetal_project_id: the project ID of the server
  • __meta_scaleway_baremetal_status: the status of the server
  • __meta_scaleway_baremetal_tags: the list of tags of the server joined by the tag separator
  • __meta_scaleway_baremetal_type: the commercial type of the server
  • __meta_scaleway_baremetal_zone: the zone of the server (ex: fr-par-1, complete list here)

This role uses the public IPv4 address by default. This can be changed with relabeling, as demonstrated in the Prometheus scaleway-sd configuration file.

See below for the configuration options for Scaleway discovery:

  1. # Access key to use. https://console.scaleway.com/project/credentials
  2. access_key: <string>
  3. # Secret key to use when listing targets. https://console.scaleway.com/project/credentials
  4. # It is mutually exclusive with `secret_key_file`.
  5. [ secret_key: <secret> ]
  6. # Sets the secret key with the credentials read from the configured file.
  7. # It is mutually exclusive with `secret_key`.
  8. [ secret_key_file: <filename> ]
  9. # Project ID of the targets.
  10. project_id: <string>
  11. # Role of the targets to retrieve. Must be `instance` or `baremetal`.
  12. role: <string>
  13. # The port to scrape metrics from.
  14. [ port: <int> | default = 80 ]
  15. # API URL to use when doing the server listing requests.
  16. [ api_url: <string> | default = "https://api.scaleway.com" ]
  17. # Zone is the availability zone of your targets (e.g. fr-par-1).
  18. [ zone: <string> | default = fr-par-1 ]
  19. # NameFilter specify a name filter (works as a LIKE) to apply on the server listing request.
  20. [ name_filter: <string> ]
  21. # TagsFilter specify a tag filter (a server needs to have all defined tags to be listed) to apply on the server listing request.
  22. tags_filter:
  23. [ - <string> ]
  24. # Refresh interval to re-read the targets list.
  25. [ refresh_interval: <duration> | default = 60s ]
  26. # Configure whether HTTP requests follow HTTP 3xx redirects.
  27. [ follow_redirects: <boolean> | default = true ]
  28. # Whether to enable HTTP2.
  29. [ enable_http2: <bool> | default: true ]
  30. # Optional proxy URL.
  31. [ proxy_url: <string> ]
  32. # Specifies headers to send to proxies during CONNECT requests.
  33. [ proxy_connect_headers:
  34. [ <string>: [<secret>, ...] ] ]
  35. # TLS configuration.
  36. tls_config:
  37. [ <tls_config> ]

<uyuni_sd_config>

Uyuni SD configurations allow retrieving scrape targets from managed systems via Uyuni API.

The following meta labels are available on targets during relabeling:

  • __meta_uyuni_endpoint_name: the name of the application endpoint
  • __meta_uyuni_exporter: the exporter exposing metrics for the target
  • __meta_uyuni_groups: the system groups of the target
  • __meta_uyuni_metrics_path: metrics path for the target
  • __meta_uyuni_minion_hostname: hostname of the Uyuni client
  • __meta_uyuni_primary_fqdn: primary FQDN of the Uyuni client
  • __meta_uyuni_proxy_module: the module name if Exporter Exporter proxy is configured for the target
  • __meta_uyuni_scheme: the protocol scheme used for requests
  • __meta_uyuni_system_id: the system ID of the client

See below for the configuration options for Uyuni discovery:

  1. # The URL to connect to the Uyuni server.
  2. server: <string>
  3. # Credentials are used to authenticate the requests to Uyuni API.
  4. username: <string>
  5. password: <secret>
  6. # The entitlement string to filter eligible systems.
  7. [ entitlement: <string> | default = monitoring_entitled ]
  8. # The string by which Uyuni group names are joined into the groups label.
  9. [ separator: <string> | default = , ]
  10. # Refresh interval to re-read the managed targets list.
  11. [ refresh_interval: <duration> | default = 60s ]
  12. # Optional HTTP basic authentication information, currently not supported by Uyuni.
  13. basic_auth:
  14. [ username: <string> ]
  15. [ password: <secret> ]
  16. [ password_file: <string> ]
  17. # Optional `Authorization` header configuration, currently not supported by Uyuni.
  18. authorization:
  19. # Sets the authentication type.
  20. [ type: <string> | default: Bearer ]
  21. # Sets the credentials. It is mutually exclusive with
  22. # `credentials_file`.
  23. [ credentials: <secret> ]
  24. # Sets the credentials to the credentials read from the configured file.
  25. # It is mutually exclusive with `credentials`.
  26. [ credentials_file: <filename> ]
  27. # Optional OAuth 2.0 configuration, currently not supported by Uyuni.
  28. # Cannot be used at the same time as basic_auth or authorization.
  29. oauth2:
  30. [ <oauth2> ]
  31. # Optional proxy URL.
  32. [ proxy_url: <string> ]
  33. # Specifies headers to send to proxies during CONNECT requests.
  34. [ proxy_connect_headers:
  35. [ <string>: [<secret>, ...] ] ]
  36. # Configure whether HTTP requests follow HTTP 3xx redirects.
  37. [ follow_redirects: <boolean> | default = true ]
  38. # Whether to enable HTTP2.
  39. [ enable_http2: <bool> | default: true ]
  40. # TLS configuration.
  41. tls_config:
  42. [ <tls_config> ]

See the Prometheus uyuni-sd configuration file for a practical example on how to set up Uyuni Prometheus configuration.

<vultr_sd_config>

Vultr SD configurations allow retrieving scrape targets from Vultr.

This service discovery uses the main IPv4 address by default, which that be changed with relabeling, as demonstrated in the Prometheus vultr-sd configuration file.

The following meta labels are available on targets during relabeling:

  • __meta_vultr_instance_id : A unique ID for the vultr Instance.
  • __meta_vultr_instance_label : The user-supplied label for this instance.
  • __meta_vultr_instance_os : The Operating System name.
  • __meta_vultr_instance_os_id : The Operating System id used by this instance.
  • __meta_vultr_instance_region : The Region id where the Instance is located.
  • __meta_vultr_instance_plan : A unique ID for the Plan.
  • __meta_vultr_instance_main_ip : The main IPv4 address.
  • __meta_vultr_instance_internal_ip : The private IP address.
  • __meta_vultr_instance_main_ipv6 : The main IPv6 address.
  • __meta_vultr_instance_features : List of features that are available to the instance.
  • __meta_vultr_instance_tags : List of tags associated with the instance.
  • __meta_vultr_instance_hostname : The hostname for this instance.
  • __meta_vultr_instance_server_status : The server health status.
  • __meta_vultr_instance_vcpu_count : Number of vCPUs.
  • __meta_vultr_instance_ram_mb : The amount of RAM in MB.
  • __meta_vultr_instance_disk_gb : The size of the disk in GB.
  • __meta_vultr_instance_allowed_bandwidth_gb : Monthly bandwidth quota in GB.
  1. # Authentication information used to authenticate to the API server.
  2. # Note that `basic_auth` and `authorization` options are
  3. # mutually exclusive.
  4. # password and password_file are mutually exclusive.
  5. # Optional HTTP basic authentication information, not currently supported by Vultr.
  6. basic_auth:
  7. [ username: <string> ]
  8. [ password: <secret> ]
  9. [ password_file: <string> ]
  10. # Optional `Authorization` header configuration.
  11. authorization:
  12. # Sets the authentication type.
  13. [ type: <string> | default: Bearer ]
  14. # Sets the credentials. It is mutually exclusive with
  15. # `credentials_file`.
  16. [ credentials: <secret> ]
  17. # Sets the credentials to the credentials read from the configured file.
  18. # It is mutually exclusive with `credentials`.
  19. [ credentials_file: <filename> ]
  20. # Optional OAuth 2.0 configuration.
  21. # Cannot be used at the same time as basic_auth or authorization.
  22. oauth2:
  23. [ <oauth2> ]
  24. # Optional proxy URL.
  25. [ proxy_url: <string> ]
  26. # Specifies headers to send to proxies during CONNECT requests.
  27. [ proxy_connect_headers:
  28. [ <string>: [<secret>, ...] ] ]
  29. # Configure whether HTTP requests follow HTTP 3xx redirects.
  30. [ follow_redirects: <boolean> | default = true ]
  31. # Whether to enable HTTP2.
  32. [ enable_http2: <bool> | default: true ]
  33. # TLS configuration.
  34. tls_config:
  35. [ <tls_config> ]
  36. # The port to scrape metrics from.
  37. [ port: <int> | default = 80 ]
  38. # The time after which the instances are refreshed.
  39. [ refresh_interval: <duration> | default = 60s ]

<static_config>

A static_config allows specifying a list of targets and a common label set for them. It is the canonical way to specify static targets in a scrape configuration.

  1. # The targets specified by the static config.
  2. targets:
  3. [ - '<host>' ]
  4. # Labels assigned to all metrics scraped from the targets.
  5. labels:
  6. [ <labelname>: <labelvalue> ... ]

<relabel_config>

Relabeling is a powerful tool to dynamically rewrite the label set of a target before 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 appearance in the configuration file.

Initially, aside from the configured per-target labels, a target’s job label is set to the job_name value of the respective scrape configuration. 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. The __scheme__ and __metrics_path__ labels are set to the scheme and metrics path of the target respectively. The __param_<name> label is set to the value of the first passed URL parameter called <name>.

The __scrape_interval__ and __scrape_timeout__ labels are set to the target’s interval and timeout. This is experimental and could change in the future.

Additional labels prefixed with __meta_ may be available during the 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 target relabeling is completed.

If a relabeling step needs to store a label value only temporarily (as the input to a subsequent relabeling step), use the __tmp label name prefix. This prefix is guaranteed to never be used by Prometheus itself.

  1. # The source labels select values from existing labels. Their content is concatenated
  2. # using the configured separator and matched against the configured regular expression
  3. # for the replace, keep, and drop actions.
  4. [ source_labels: '[' <labelname> [, ...] ']' ]
  5. # Separator placed between concatenated source label values.
  6. [ separator: <string> | default = ; ]
  7. # Label to which the resulting value is written in a replace action.
  8. # It is mandatory for replace actions. Regex capture groups are available.
  9. [ target_label: <labelname> ]
  10. # Regular expression against which the extracted value is matched.
  11. [ regex: <regex> | default = (.*) ]
  12. # Modulus to take of the hash of the source label values.
  13. [ modulus: <int> ]
  14. # Replacement value against which a regex replace is performed if the
  15. # regular expression matches. Regex capture groups are available.
  16. [ replacement: <string> | default = $1 ]
  17. # Action to perform based on regex matching.
  18. [ action: <relabel_action> | default = replace ]

<regex> is any valid RE2 regular expression. It is required for the replace, keep, drop, labelmap,labeldrop and labelkeep actions. The regex is anchored on both ends. To un-anchor the regex, use .*<regex>.*.

<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. If regex does not match, no replacement takes place.
  • lowercase: Maps the concatenated source_labels to their lower case.
  • uppercase: Maps the concatenated source_labels to their upper case.
  • keep: Drop targets for which regex does not match the concatenated source_labels.
  • drop: Drop targets for which regex matches the concatenated source_labels.
  • keepequal: Drop targets for which the concatenated source_labels do not match target_label.
  • dropequal: Drop targets for which the concatenated source_labels do match target_label.
  • hashmod: Set target_label to the modulus of a hash of the concatenated source_labels.
  • labelmap: Match regex against all source label names, not just those specified in source_labels. Then copy the values of the matching labels to label names given by replacement with match group references (${1}, ${2}, …) in replacement substituted by their value.
  • labeldrop: Match regex against all label names. Any label that matches will be removed from the set of labels.
  • labelkeep: Match regex against all label names. Any label that does not match will be removed from the set of labels.

Care must be taken with labeldrop and labelkeep to ensure that metrics are still uniquely labeled once the labels are removed.

<metric_relabel_configs>

Metric relabeling is applied to samples as the last step before ingestion. It has the same configuration format and actions as target relabeling. Metric relabeling does not apply to automatically generated timeseries such as up.

One use for this is to exclude time series that are too expensive to ingest.

<alert_relabel_configs>

Alert relabeling is applied to alerts before they are sent to the Alertmanager. It has the same configuration format and actions as target relabeling. Alert relabeling is applied after external labels.

One use for this is ensuring a HA pair of Prometheus servers with different external labels send identical alerts.

<alertmanager_config>

An alertmanager_config section specifies Alertmanager instances the Prometheus server sends alerts to. It also provides parameters to configure how to communicate with these Alertmanagers.

Alertmanagers may be statically configured via the static_configs parameter or dynamically discovered using one of the supported service-discovery mechanisms.

Additionally, relabel_configs allow selecting Alertmanagers from discovered entities and provide advanced modifications to the used API path, which is exposed through the __alerts_path__ label.

  1. # Per-target Alertmanager timeout when pushing alerts.
  2. [ timeout: <duration> | default = 10s ]
  3. # The api version of Alertmanager.
  4. [ api_version: <string> | default = v2 ]
  5. # Prefix for the HTTP path alerts are pushed to.
  6. [ path_prefix: <path> | default = / ]
  7. # Configures the protocol scheme used for requests.
  8. [ scheme: <scheme> | default = http ]
  9. # Sets the `Authorization` header on every request with the
  10. # configured username and password.
  11. # password and password_file are mutually exclusive.
  12. basic_auth:
  13. [ username: <string> ]
  14. [ password: <secret> ]
  15. [ password_file: <string> ]
  16. # Optional `Authorization` header configuration.
  17. authorization:
  18. # Sets the authentication type.
  19. [ type: <string> | default: Bearer ]
  20. # Sets the credentials. It is mutually exclusive with
  21. # `credentials_file`.
  22. [ credentials: <secret> ]
  23. # Sets the credentials to the credentials read from the configured file.
  24. # It is mutually exclusive with `credentials`.
  25. [ credentials_file: <filename> ]
  26. # Optional OAuth 2.0 configuration.
  27. # Cannot be used at the same time as basic_auth or authorization.
  28. oauth2:
  29. [ <oauth2> ]
  30. # Configures the scrape request's TLS settings.
  31. tls_config:
  32. [ <tls_config> ]
  33. # Optional proxy URL.
  34. [ proxy_url: <string> ]
  35. # Specifies headers to send to proxies during CONNECT requests.
  36. [ proxy_connect_headers:
  37. [ <string>: [<secret>, ...] ] ]
  38. # Configure whether HTTP requests follow HTTP 3xx redirects.
  39. [ follow_redirects: <boolean> | default = true ]
  40. # Whether to enable HTTP2.
  41. [ enable_http2: <bool> | default: true ]
  42. # List of Azure service discovery configurations.
  43. azure_sd_configs:
  44. [ - <azure_sd_config> ... ]
  45. # List of Consul service discovery configurations.
  46. consul_sd_configs:
  47. [ - <consul_sd_config> ... ]
  48. # List of DNS service discovery configurations.
  49. dns_sd_configs:
  50. [ - <dns_sd_config> ... ]
  51. # List of EC2 service discovery configurations.
  52. ec2_sd_configs:
  53. [ - <ec2_sd_config> ... ]
  54. # List of Eureka service discovery configurations.
  55. eureka_sd_configs:
  56. [ - <eureka_sd_config> ... ]
  57. # List of file service discovery configurations.
  58. file_sd_configs:
  59. [ - <file_sd_config> ... ]
  60. # List of DigitalOcean service discovery configurations.
  61. digitalocean_sd_configs:
  62. [ - <digitalocean_sd_config> ... ]
  63. # List of Docker service discovery configurations.
  64. docker_sd_configs:
  65. [ - <docker_sd_config> ... ]
  66. # List of Docker Swarm service discovery configurations.
  67. dockerswarm_sd_configs:
  68. [ - <dockerswarm_sd_config> ... ]
  69. # List of GCE service discovery configurations.
  70. gce_sd_configs:
  71. [ - <gce_sd_config> ... ]
  72. # List of Hetzner service discovery configurations.
  73. hetzner_sd_configs:
  74. [ - <hetzner_sd_config> ... ]
  75. # List of HTTP service discovery configurations.
  76. http_sd_configs:
  77. [ - <http_sd_config> ... ]
  78. # List of IONOS service discovery configurations.
  79. ionos_sd_configs:
  80. [ - <ionos_sd_config> ... ]
  81. # List of Kubernetes service discovery configurations.
  82. kubernetes_sd_configs:
  83. [ - <kubernetes_sd_config> ... ]
  84. # List of Lightsail service discovery configurations.
  85. lightsail_sd_configs:
  86. [ - <lightsail_sd_config> ... ]
  87. # List of Linode service discovery configurations.
  88. linode_sd_configs:
  89. [ - <linode_sd_config> ... ]
  90. # List of Marathon service discovery configurations.
  91. marathon_sd_configs:
  92. [ - <marathon_sd_config> ... ]
  93. # List of AirBnB's Nerve service discovery configurations.
  94. nerve_sd_configs:
  95. [ - <nerve_sd_config> ... ]
  96. # List of Nomad service discovery configurations.
  97. nomad_sd_configs:
  98. [ - <nomad_sd_config> ... ]
  99. # List of OpenStack service discovery configurations.
  100. openstack_sd_configs:
  101. [ - <openstack_sd_config> ... ]
  102. # List of OVHcloud service discovery configurations.
  103. ovhcloud_sd_configs:
  104. [ - <ovhcloud_sd_config> ... ]
  105. # List of PuppetDB service discovery configurations.
  106. puppetdb_sd_configs:
  107. [ - <puppetdb_sd_config> ... ]
  108. # List of Scaleway service discovery configurations.
  109. scaleway_sd_configs:
  110. [ - <scaleway_sd_config> ... ]
  111. # List of Zookeeper Serverset service discovery configurations.
  112. serverset_sd_configs:
  113. [ - <serverset_sd_config> ... ]
  114. # List of Triton service discovery configurations.
  115. triton_sd_configs:
  116. [ - <triton_sd_config> ... ]
  117. # List of Uyuni service discovery configurations.
  118. uyuni_sd_configs:
  119. [ - <uyuni_sd_config> ... ]
  120. # List of Vultr service discovery configurations.
  121. vultr_sd_configs:
  122. [ - <vultr_sd_config> ... ]
  123. # List of labeled statically configured Alertmanagers.
  124. static_configs:
  125. [ - <static_config> ... ]
  126. # List of Alertmanager relabel configurations.
  127. relabel_configs:
  128. [ - <relabel_config> ... ]

<remote_write>

write_relabel_configs is relabeling applied to samples before sending them to the remote endpoint. Write relabeling is applied after external labels. This could be used to limit which samples are sent.

There is a small demo of how to use this functionality.

  1. # The URL of the endpoint to send samples to.
  2. url: <string>
  3. # Timeout for requests to the remote write endpoint.
  4. [ remote_timeout: <duration> | default = 30s ]
  5. # Custom HTTP headers to be sent along with each remote write request.
  6. # Be aware that headers that are set by Prometheus itself can't be overwritten.
  7. headers:
  8. [ <string>: <string> ... ]
  9. # List of remote write relabel configurations.
  10. write_relabel_configs:
  11. [ - <relabel_config> ... ]
  12. # Name of the remote write config, which if specified must be unique among remote write configs.
  13. # The name will be used in metrics and logging in place of a generated value to help users distinguish between
  14. # remote write configs.
  15. [ name: <string> ]
  16. # Enables sending of exemplars over remote write. Note that exemplar storage itself must be enabled for exemplars to be scraped in the first place.
  17. [ send_exemplars: <boolean> | default = false ]
  18. # Enables sending of native histograms, also known as sparse histograms, over remote write.
  19. [ send_native_histograms: <boolean> | default = false ]
  20. # Sets the `Authorization` header on every remote write request with the
  21. # configured username and password.
  22. # password and password_file are mutually exclusive.
  23. basic_auth:
  24. [ username: <string> ]
  25. [ password: <secret> ]
  26. [ password_file: <string> ]
  27. # Optional `Authorization` header configuration.
  28. authorization:
  29. # Sets the authentication type.
  30. [ type: <string> | default: Bearer ]
  31. # Sets the credentials. It is mutually exclusive with
  32. # `credentials_file`.
  33. [ credentials: <secret> ]
  34. # Sets the credentials to the credentials read from the configured file.
  35. # It is mutually exclusive with `credentials`.
  36. [ credentials_file: <filename> ]
  37. # Optionally configures AWS's Signature Verification 4 signing process to
  38. # sign requests. Cannot be set at the same time as basic_auth, authorization, or oauth2.
  39. # To use the default credentials from the AWS SDK, use `sigv4: {}`.
  40. sigv4:
  41. # The AWS region. If blank, the region from the default credentials chain
  42. # is used.
  43. [ region: <string> ]
  44. # The AWS API keys. If blank, the environment variables `AWS_ACCESS_KEY_ID`
  45. # and `AWS_SECRET_ACCESS_KEY` are used.
  46. [ access_key: <string> ]
  47. [ secret_key: <secret> ]
  48. # Named AWS profile used to authenticate.
  49. [ profile: <string> ]
  50. # AWS Role ARN, an alternative to using AWS API keys.
  51. [ role_arn: <string> ]
  52. # Optional OAuth 2.0 configuration.
  53. # Cannot be used at the same time as basic_auth, authorization, or sigv4.
  54. oauth2:
  55. [ <oauth2> ]
  56. # Configures the remote write request's TLS settings.
  57. tls_config:
  58. [ <tls_config> ]
  59. # Optional proxy URL.
  60. [ proxy_url: <string> ]
  61. # Specifies headers to send to proxies during CONNECT requests.
  62. [ proxy_connect_headers:
  63. [ <string>: [<secret>, ...] ] ]
  64. # Configure whether HTTP requests follow HTTP 3xx redirects.
  65. [ follow_redirects: <boolean> | default = true ]
  66. # Whether to enable HTTP2.
  67. [ enable_http2: <bool> | default: true ]
  68. # Configures the queue used to write to remote storage.
  69. queue_config:
  70. # Number of samples to buffer per shard before we block reading of more
  71. # samples from the WAL. It is recommended to have enough capacity in each
  72. # shard to buffer several requests to keep throughput up while processing
  73. # occasional slow remote requests.
  74. [ capacity: <int> | default = 2500 ]
  75. # Maximum number of shards, i.e. amount of concurrency.
  76. [ max_shards: <int> | default = 200 ]
  77. # Minimum number of shards, i.e. amount of concurrency.
  78. [ min_shards: <int> | default = 1 ]
  79. # Maximum number of samples per send.
  80. [ max_samples_per_send: <int> | default = 500]
  81. # Maximum time a sample will wait in buffer.
  82. [ batch_send_deadline: <duration> | default = 5s ]
  83. # Initial retry delay. Gets doubled for every retry.
  84. [ min_backoff: <duration> | default = 30ms ]
  85. # Maximum retry delay.
  86. [ max_backoff: <duration> | default = 5s ]
  87. # Retry upon receiving a 429 status code from the remote-write storage.
  88. # This is experimental and might change in the future.
  89. [ retry_on_http_429: <boolean> | default = false ]
  90. # Configures the sending of series metadata to remote storage.
  91. # Metadata configuration is subject to change at any point
  92. # or be removed in future releases.
  93. metadata_config:
  94. # Whether metric metadata is sent to remote storage or not.
  95. [ send: <boolean> | default = true ]
  96. # How frequently metric metadata is sent to remote storage.
  97. [ send_interval: <duration> | default = 1m ]
  98. # Maximum number of samples per send.
  99. [ max_samples_per_send: <int> | default = 500]

There is a list of integrations with this feature.

<remote_read>

  1. # The URL of the endpoint to query from.
  2. url: <string>
  3. # Name of the remote read config, which if specified must be unique among remote read configs.
  4. # The name will be used in metrics and logging in place of a generated value to help users distinguish between
  5. # remote read configs.
  6. [ name: <string> ]
  7. # An optional list of equality matchers which have to be
  8. # present in a selector to query the remote read endpoint.
  9. required_matchers:
  10. [ <labelname>: <labelvalue> ... ]
  11. # Timeout for requests to the remote read endpoint.
  12. [ remote_timeout: <duration> | default = 1m ]
  13. # Custom HTTP headers to be sent along with each remote read request.
  14. # Be aware that headers that are set by Prometheus itself can't be overwritten.
  15. headers:
  16. [ <string>: <string> ... ]
  17. # Whether reads should be made for queries for time ranges that
  18. # the local storage should have complete data for.
  19. [ read_recent: <boolean> | default = false ]
  20. # Sets the `Authorization` header on every remote read request with the
  21. # configured username and password.
  22. # password and password_file are mutually exclusive.
  23. basic_auth:
  24. [ username: <string> ]
  25. [ password: <secret> ]
  26. [ password_file: <string> ]
  27. # Optional `Authorization` header configuration.
  28. authorization:
  29. # Sets the authentication type.
  30. [ type: <string> | default: Bearer ]
  31. # Sets the credentials. It is mutually exclusive with
  32. # `credentials_file`.
  33. [ credentials: <secret> ]
  34. # Sets the credentials to the credentials read from the configured file.
  35. # It is mutually exclusive with `credentials`.
  36. [ credentials_file: <filename> ]
  37. # Optional OAuth 2.0 configuration.
  38. # Cannot be used at the same time as basic_auth or authorization.
  39. oauth2:
  40. [ <oauth2> ]
  41. # Configures the remote read request's TLS settings.
  42. tls_config:
  43. [ <tls_config> ]
  44. # Optional proxy URL.
  45. [ proxy_url: <string> ]
  46. # Specifies headers to send to proxies during CONNECT requests.
  47. [ proxy_connect_headers:
  48. [ <string>: [<secret>, ...] ] ]
  49. # Configure whether HTTP requests follow HTTP 3xx redirects.
  50. [ follow_redirects: <boolean> | default = true ]
  51. # Whether to enable HTTP2.
  52. [ enable_http2: <bool> | default: true ]
  53. # Whether to use the external labels as selectors for the remote read endpoint.
  54. [ filter_external_labels: <boolean> | default = true ]

There is a list of integrations with this feature.

<tsdb>

tsdb lets you configure the runtime-reloadable configuration settings of the TSDB.

NOTE: Out-of-order ingestion is an experimental feature, but you do not need any additional flag to enable it. Setting out_of_order_time_window to a positive duration enables it.

  1. # Configures how old an out-of-order/out-of-bounds sample can be w.r.t. the TSDB max time.
  2. # An out-of-order/out-of-bounds sample is ingested into the TSDB as long as the timestamp
  3. # of the sample is >= TSDB.MaxTime-out_of_order_time_window.
  4. #
  5. # When out_of_order_time_window is >0, the errors out-of-order and out-of-bounds are
  6. # combined into a single error called 'too-old'; a sample is either (a) ingestible
  7. # into the TSDB, i.e. it is an in-order sample or an out-of-order/out-of-bounds sample
  8. # that is within the out-of-order window, or (b) too-old, i.e. not in-order
  9. # and before the out-of-order window.
  10. [ out_of_order_time_window: <duration> | default = 0s ]

<exemplars>

Note that exemplar storage is still considered experimental and must be enabled via --enable-feature=exemplar-storage.

  1. # Configures the maximum size of the circular buffer used to store exemplars for all series. Resizable during runtime.
  2. [ max_exemplars: <int> | default = 100000 ]

<tracing_config>

tracing_config configures exporting traces from Prometheus to a tracing backend via the OTLP protocol. Tracing is currently an experimental feature and could change in the future.

  1. # Client used to export the traces. Options are 'http' or 'grpc'.
  2. [ client_type: <string> | default = grpc ]
  3. # Endpoint to send the traces to. Should be provided in format <host>:<port>.
  4. [ endpoint: <string> ]
  5. # Sets the probability a given trace will be sampled. Must be a float from 0 through 1.
  6. [ sampling_fraction: <float> | default = 0 ]
  7. # If disabled, the client will use a secure connection.
  8. [ insecure: <boolean> | default = false ]
  9. # Key-value pairs to be used as headers associated with gRPC or HTTP requests.
  10. headers:
  11. [ <string>: <string> ... ]
  12. # Compression key for supported compression types. Supported compression: gzip.
  13. [ compression: <string> ]
  14. # Maximum time the exporter will wait for each batch export.
  15. [ timeout: <duration> | default = 10s ]
  16. # TLS configuration.
  17. tls_config:
  18. [ <tls_config> ]

This documentation is open-source. Please help improve it by filing issues or pull requests.