設定

Prometheusは、コマンドラインフラグと設定ファイルによって設定されます。コマンドラインフラグは、ストレージの場所、ディスクとメモリに保持するデータ量など、不変のシステムパラメーターを設定しますが、設定ファイルは、ジョブとそのインスタンスのスクレイピングに関するすべてと、どのルールファイルを読み込むかを定義します。

使用可能なコマンドラインフラグをすべて表示するには、./prometheus -hを実行します。

Prometheusは、実行時に設定をリロードできます。新しい設定が正しく形成されていない場合、変更は適用されません。設定のリロードは、PrometheusプロセスにSIGHUPを送信するか、--web.enable-lifecycleフラグが有効になっている場合に/-/reloadエンドポイントにHTTP POSTリクエストを送信することでトリガーされます。これにより、設定されているルールファイルもリロードされます。

設定ファイル

読み込む設定ファイルを指定するには、--config.fileフラグを使用します。

このファイルはYAML形式で記述され、以下に説明するスキームで定義されます。角括弧は、パラメーターがオプションであることを示します。リスト以外のパラメーターの場合、値は指定されたデフォルトに設定されます。

一般的なプレースホルダーは次のように定義されます。

  • <boolean>: trueまたはfalseの値をとることができるブール値
  • <duration>: 正規表現((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)に一致する期間、例:1d1h30m5m10s
  • <filename>: 現在の作業ディレクトリ内の有効なパス
  • <float>: 浮動小数点数
  • <host>: ホスト名またはIPアドレスにオプションのポート番号を付けた有効な文字列
  • <int>: 整数値
  • <labelname>: 正規表現[a-zA-Z_][a-zA-Z0-9_]*に一致する文字列。ソースラベル内のその他のサポートされていない文字は、アンダースコアに変換する必要があります。たとえば、ラベルapp.kubernetes.io/nameapp_kubernetes_io_nameとして記述する必要があります。
  • <labelvalue>: Unicode文字の文字列
  • <path>: 有効なURLパス
  • <scheme>: httpまたはhttpsの値をとることができる文字列
  • <secret>: パスワードなどの秘密情報である通常の文字列
  • <string>: 通常の文字列
  • <size>: バイト単位のサイズ、例:512MB。単位が必要です。サポートされている単位:B、KB、MB、GB、TB、PB、EB。
  • <tmpl_string>: 使用前にテンプレート展開される文字列

他のプレースホルダーは別途指定されています。

有効なファイルの例はこちらにあります。

グローバル設定は、他のすべての設定コンテキストで有効なパラメーターを指定します。それらは、他の設定セクションのデフォルトとしても機能します。

global:
  # How frequently to scrape targets by default.
  [ scrape_interval: <duration> | default = 1m ]

  # How long until a scrape request times out.
  [ scrape_timeout: <duration> | default = 10s ]

  # The protocols to negotiate during a scrape with the client.
  # Supported values (case sensitive): PrometheusProto, OpenMetricsText0.0.1,
  # OpenMetricsText1.0.0, PrometheusText0.0.4.
  # The default value changes to [ PrometheusProto, OpenMetricsText1.0.0, OpenMetricsText0.0.1, PrometheusText0.0.4 ]
  # when native_histogram feature flag is set.
  [ scrape_protocols: [<string>, ...] | default = [ OpenMetricsText1.0.0, OpenMetricsText0.0.1, PrometheusText0.0.4 ] ]

  # How frequently to evaluate rules.
  [ evaluation_interval: <duration> | default = 1m ]

  # Offset the rule evaluation timestamp of this particular group by the specified duration into the past to ensure the underlying metrics have been received.
  # Metric availability delays are more likely to occur when Prometheus is running as a remote write target, but can also occur when there's anomalies with scraping.
  [ rule_query_offset: <duration> | default = 0s ]

  # The labels to add to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
    [ <labelname>: <labelvalue> ... ]

  # File to which PromQL queries are logged.
  # Reloading the configuration will reopen the file.
  [ query_log_file: <string> ]

  # An uncompressed response body larger than this many bytes will cause the
  # scrape to fail. 0 means no limit. Example: 100MB.
  # This is an experimental feature, this behaviour could
  # change or be removed in the future.
  [ body_size_limit: <size> | default = 0 ]

  # Per-scrape limit on number of scraped samples that will be accepted.
  # If more than this number of samples are present after metric relabeling
  # the entire scrape will be treated as failed. 0 means no limit.
  [ sample_limit: <int> | default = 0 ]

  # Per-scrape limit on number of labels that will be accepted for a sample. If
  # more than this number of labels are present post metric-relabeling, the
  # entire scrape will be treated as failed. 0 means no limit.
  [ label_limit: <int> | default = 0 ]

  # Per-scrape limit on length of labels name that will be accepted for a sample.
  # If a label name is longer than this number post metric-relabeling, the entire
  # scrape will be treated as failed. 0 means no limit.
  [ label_name_length_limit: <int> | default = 0 ]

  # Per-scrape limit on length of labels value that will be accepted for a sample.
  # If a label value is longer than this number post metric-relabeling, the
  # entire scrape will be treated as failed. 0 means no limit.
  [ label_value_length_limit: <int> | default = 0 ]

  # Per-scrape config limit on number of unique targets that will be
  # accepted. If more than this number of targets are present after target
  # relabeling, Prometheus will mark the targets as failed without scraping them.
  # 0 means no limit. This is an experimental feature, this behaviour could
  # change in the future.
  [ target_limit: <int> | default = 0 ]

  # Limit per scrape config on the number of targets dropped by relabeling
  # that will be kept in memory. 0 means no limit.
  [ keep_dropped_targets: <int> | default = 0 ]

runtime:
  # Configure the Go garbage collector GOGC parameter
  # See: https://tip.golang.org/doc/gc-guide#GOGC
  # Lowering this number increases CPU usage.
  [ gogc: <int> | default = 75 ]

# Rule files specifies a list of globs. Rules and alerts are read from
# all matching files.
rule_files:
  [ - <filepath_glob> ... ]

# Scrape config files specifies a list of globs. Scrape configs are read from
# all matching files and appended to the list of scrape configs.
scrape_config_files:
  [ - <filepath_glob> ... ]

# A list of scrape configurations.
scrape_configs:
  [ - <scrape_config> ... ]

# Alerting specifies settings related to the Alertmanager.
alerting:
  alert_relabel_configs:
    [ - <relabel_config> ... ]
  alertmanagers:
    [ - <alertmanager_config> ... ]

# Settings related to the remote write feature.
remote_write:
  [ - <remote_write> ... ]

# Settings related to the remote read feature.
remote_read:
  [ - <remote_read> ... ]

# Storage related settings that are runtime reloadable.
storage:
  [ tsdb: <tsdb> ]
  [ exemplars: <exemplars> ]

# Configures exporting traces.
tracing:
  [ <tracing_config> ]

<scrape_config>

scrape_configセクションは、ターゲットのセットと、それらをスクレイプする方法を記述するパラメーターを指定します。一般的なケースでは、1つのスクレイプ設定で1つのジョブが指定されます。高度な設定では、これは変更される可能性があります。

ターゲットは、static_configsパラメーターを使用して静的に設定するか、サポートされているサービス検出メカニズムのいずれかを使用して動的に検出できます。

さらに、relabel_configsを使用すると、スクレイプする前に、任意のターゲットとそのラベルを高度に変更できます。

# The job name assigned to scraped metrics by default.
job_name: <job_name>

# How frequently to scrape targets from this job.
[ scrape_interval: <duration> | default = <global_config.scrape_interval> ]

# Per-scrape timeout when scraping this job.
[ scrape_timeout: <duration> | default = <global_config.scrape_timeout> ]

# The protocols to negotiate during a scrape with the client.
# Supported values (case sensitive): PrometheusProto, OpenMetricsText0.0.1,
# OpenMetricsText1.0.0, PrometheusText0.0.4.
[ scrape_protocols: [<string>, ...] | default = <global_config.scrape_protocols> ]

# Whether to scrape a classic histogram that is also exposed as a native
# histogram (has no effect without --enable-feature=native-histograms).
[ scrape_classic_histograms: <boolean> | default = false ]

# The HTTP resource path on which to fetch metrics from targets.
[ metrics_path: <path> | default = /metrics ]

# honor_labels controls how Prometheus handles conflicts between labels that are
# already present in scraped data and labels that Prometheus would attach
# server-side ("job" and "instance" labels, manually configured target
# labels, and labels generated by service discovery implementations).
#
# If honor_labels is set to "true", label conflicts are resolved by keeping label
# values from the scraped data and ignoring the conflicting server-side labels.
#
# If honor_labels is set to "false", label conflicts are resolved by renaming
# conflicting labels in the scraped data to "exported_<original-label>" (for
# example "exported_instance", "exported_job") and then attaching server-side
# labels.
#
# Setting honor_labels to "true" is useful for use cases such as federation and
# scraping the Pushgateway, where all labels specified in the target should be
# preserved.
#
# Note that any globally configured "external_labels" are unaffected by this
# setting. In communication with external systems, they are always applied only
# when a time series does not have a given label yet and are ignored otherwise.
[ honor_labels: <boolean> | default = false ]

# honor_timestamps controls whether Prometheus respects the timestamps present
# in scraped data.
#
# If honor_timestamps is set to "true", the timestamps of the metrics exposed
# by the target will be used.
#
# If honor_timestamps is set to "false", the timestamps of the metrics exposed
# by the target will be ignored.
[ honor_timestamps: <boolean> | default = true ]

# track_timestamps_staleness controls whether Prometheus tracks staleness of
# the metrics that have an explicit timestamps present in scraped data.
#
# If track_timestamps_staleness is set to "true", a staleness marker will be
# inserted in the TSDB when a metric is no longer present or the target
# is down.
[ track_timestamps_staleness: <boolean> | default = false ]

# Configures the protocol scheme used for requests.
[ scheme: <scheme> | default = http ]

# Optional HTTP URL parameters.
params:
  [ <string>: [<string>, ...] ]

# If enable_compression is set to "false", Prometheus will request uncompressed
# response from the scraped target.
[ enable_compression: <boolean> | default = true ]

# Sets the `Authorization` header on every scrape request with the
# configured username and password.
# password and password_file are mutually exclusive.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Sets the `Authorization` header on every scrape request with
# the configured credentials.
authorization:
  # Sets the authentication type of the request.
  [ type: <string> | default: Bearer ]
  # Sets the credentials of the request. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials of the request with the credentials read from the
  # configured file. It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Configure whether scrape requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# Configures the scrape request's TLS settings.
tls_config:
  [ <tls_config> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]


# List of Azure service discovery configurations.
azure_sd_configs:
  [ - <azure_sd_config> ... ]

# List of Consul service discovery configurations.
consul_sd_configs:
  [ - <consul_sd_config> ... ]

# List of DigitalOcean service discovery configurations.
digitalocean_sd_configs:
  [ - <digitalocean_sd_config> ... ]

# List of Docker service discovery configurations.
docker_sd_configs:
  [ - <docker_sd_config> ... ]

# List of Docker Swarm service discovery configurations.
dockerswarm_sd_configs:
  [ - <dockerswarm_sd_config> ... ]

# List of DNS service discovery configurations.
dns_sd_configs:
  [ - <dns_sd_config> ... ]

# List of EC2 service discovery configurations.
ec2_sd_configs:
  [ - <ec2_sd_config> ... ]

# List of Eureka service discovery configurations.
eureka_sd_configs:
  [ - <eureka_sd_config> ... ]

# List of file service discovery configurations.
file_sd_configs:
  [ - <file_sd_config> ... ]

# List of GCE service discovery configurations.
gce_sd_configs:
  [ - <gce_sd_config> ... ]

# List of Hetzner service discovery configurations.
hetzner_sd_configs:
  [ - <hetzner_sd_config> ... ]

# List of HTTP service discovery configurations.
http_sd_configs:
  [ - <http_sd_config> ... ]


# List of IONOS service discovery configurations.
ionos_sd_configs:
  [ - <ionos_sd_config> ... ]

# List of Kubernetes service discovery configurations.
kubernetes_sd_configs:
  [ - <kubernetes_sd_config> ... ]

# List of Kuma service discovery configurations.
kuma_sd_configs:
  [ - <kuma_sd_config> ... ]

# List of Lightsail service discovery configurations.
lightsail_sd_configs:
  [ - <lightsail_sd_config> ... ]

# List of Linode service discovery configurations.
linode_sd_configs:
  [ - <linode_sd_config> ... ]

# List of Marathon service discovery configurations.
marathon_sd_configs:
  [ - <marathon_sd_config> ... ]

# List of AirBnB's Nerve service discovery configurations.
nerve_sd_configs:
  [ - <nerve_sd_config> ... ]

# List of Nomad service discovery configurations.
nomad_sd_configs:
  [ - <nomad_sd_config> ... ]

# List of OpenStack service discovery configurations.
openstack_sd_configs:
  [ - <openstack_sd_config> ... ]

# List of OVHcloud service discovery configurations.
ovhcloud_sd_configs:
  [ - <ovhcloud_sd_config> ... ]

# List of PuppetDB service discovery configurations.
puppetdb_sd_configs:
  [ - <puppetdb_sd_config> ... ]

# List of Scaleway service discovery configurations.
scaleway_sd_configs:
  [ - <scaleway_sd_config> ... ]

# List of Zookeeper Serverset service discovery configurations.
serverset_sd_configs:
  [ - <serverset_sd_config> ... ]

# List of Triton service discovery configurations.
triton_sd_configs:
  [ - <triton_sd_config> ... ]

# List of Uyuni service discovery configurations.
uyuni_sd_configs:
  [ - <uyuni_sd_config> ... ]

# List of labeled statically configured targets for this job.
static_configs:
  [ - <static_config> ... ]

# List of target relabel configurations.
relabel_configs:
  [ - <relabel_config> ... ]

# List of metric relabel configurations.
metric_relabel_configs:
  [ - <relabel_config> ... ]

# An uncompressed response body larger than this many bytes will cause the
# scrape to fail. 0 means no limit. Example: 100MB.
# This is an experimental feature, this behaviour could
# change or be removed in the future.
[ body_size_limit: <size> | default = 0 ]

# Per-scrape limit on number of scraped samples that will be accepted.
# If more than this number of samples are present after metric relabeling
# the entire scrape will be treated as failed. 0 means no limit.
[ sample_limit: <int> | default = 0 ]

# Per-scrape limit on number of labels that will be accepted for a sample. If
# more than this number of labels are present post metric-relabeling, the
# entire scrape will be treated as failed. 0 means no limit.
[ label_limit: <int> | default = 0 ]

# Per-scrape limit on length of labels name that will be accepted for a sample.
# If a label name is longer than this number post metric-relabeling, the entire
# scrape will be treated as failed. 0 means no limit.
[ label_name_length_limit: <int> | default = 0 ]

# Per-scrape limit on length of labels value that will be accepted for a sample.
# If a label value is longer than this number post metric-relabeling, the
# entire scrape will be treated as failed. 0 means no limit.
[ label_value_length_limit: <int> | default = 0 ]

# Per-scrape config limit on number of unique targets that will be
# accepted. If more than this number of targets are present after target
# relabeling, Prometheus will mark the targets as failed without scraping them.
# 0 means no limit. This is an experimental feature, this behaviour could
# change in the future.
[ target_limit: <int> | default = 0 ]

# Per-job limit on the number of targets dropped by relabeling
# that will be kept in memory. 0 means no limit.
[ keep_dropped_targets: <int> | default = 0 ]

# Limit on total number of positive and negative buckets allowed in a single
# native histogram. The resolution of a histogram with more buckets will be
# reduced until the number of buckets is within the limit. If the limit cannot
# be reached, the scrape will fail.
# 0 means no limit.
[ native_histogram_bucket_limit: <int> | default = 0 ]

# Lower limit for the growth factor of one bucket to the next in each native
# histogram. The resolution of a histogram with a lower growth factor will be
# reduced as much as possible until it is within the limit.
# To set an upper limit for the schema (equivalent to "scale" in OTel's
# exponential histograms), use the following factor limits:
# 
# +----------------------------+----------------------------+
# |        growth factor       | resulting schema AKA scale |
# +----------------------------+----------------------------+
# |          65536             |             -4             |
# +----------------------------+----------------------------+
# |            256             |             -3             |
# +----------------------------+----------------------------+
# |             16             |             -2             |
# +----------------------------+----------------------------+
# |              4             |             -1             |
# +----------------------------+----------------------------+
# |              2             |              0             |
# +----------------------------+----------------------------+
# |              1.4           |              1             |
# +----------------------------+----------------------------+
# |              1.1           |              2             |
# +----------------------------+----------------------------+
# |              1.09          |              3             |
# +----------------------------+----------------------------+
# |              1.04          |              4             |
# +----------------------------+----------------------------+
# |              1.02          |              5             |
# +----------------------------+----------------------------+
# |              1.01          |              6             |
# +----------------------------+----------------------------+
# |              1.005         |              7             |
# +----------------------------+----------------------------+
# |              1.002         |              8             |
# +----------------------------+----------------------------+
# 
# 0 results in the smallest supported factor (which is currently ~1.0027 or
# schema 8, but might change in the future).
[ native_histogram_min_bucket_factor: <float> | default = 0 ]

ここで、<job_name>は、すべてのスクレイプ設定で一意である必要があります。

<tls_config>

tls_configを使用すると、TLS接続を設定できます。

# CA certificate to validate API server certificate with. At most one of ca and ca_file is allowed.
[ ca: <string> ]
[ ca_file: <filename> ]

# Certificate and key for client cert authentication to the server.
# At most one of cert and cert_file is allowed.
# At most one of key and key_file is allowed.
[ cert: <string> ]
[ cert_file: <filename> ]
[ key: <secret> ]
[ key_file: <filename> ]

# ServerName extension to indicate the name of the server.
# https://tools.ietf.org/html/rfc4366#section-3.1
[ server_name: <string> ]

# Disable validation of the server certificate.
[ insecure_skip_verify: <boolean> ]

# Minimum acceptable TLS version. Accepted values: TLS10 (TLS 1.0), TLS11 (TLS
# 1.1), TLS12 (TLS 1.2), TLS13 (TLS 1.3).
# If unset, Prometheus will use Go default minimum version, which is TLS 1.2.
# See MinVersion in https://pkg.go.dev/crypto/tls#Config.
[ min_version: <string> ]
# Maximum acceptable TLS version. Accepted values: TLS10 (TLS 1.0), TLS11 (TLS
# 1.1), TLS12 (TLS 1.2), TLS13 (TLS 1.3).
# If unset, Prometheus will use Go default maximum version, which is TLS 1.3.
# See MaxVersion in https://pkg.go.dev/crypto/tls#Config.
[ max_version: <string> ]

<oauth2>

クライアント資格情報付与タイプを使用したOAuth 2.0認証。Prometheusは、指定されたエンドポイントから、指定されたクライアントアクセスキーとシークレットキーを使用してアクセストークンを取得します。

client_id: <string>
[ client_secret: <secret> ]

# Read the client secret from a file.
# It is mutually exclusive with `client_secret`.
[ client_secret_file: <filename> ]

# Scopes for the token request.
scopes:
  [ - <string> ... ]

# The URL to fetch the token from.
token_url: <string>

# Optional parameters to append to the token URL.
endpoint_params:
  [ <string>: <string> ... ]

# Configures the token request's TLS settings.
tls_config:
  [ <tls_config> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

<azure_sd_config>

Azure SD設定を使用すると、Azure VMからスクレイプターゲットを取得できます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_azure_machine_id: マシンID
  • __meta_azure_machine_location: マシンが実行されている場所
  • __meta_azure_machine_name: マシン名
  • __meta_azure_machine_computer_name: マシンのコンピューター名
  • __meta_azure_machine_os_type: マシンのオペレーティングシステム
  • __meta_azure_machine_private_ip: マシンのプライベートIP
  • __meta_azure_machine_public_ip: 存在する場合のマシンのパブリックIP
  • __meta_azure_machine_resource_group: マシンのリソースグループ
  • __meta_azure_machine_tag_<tagname>: マシンの各タグ値
  • __meta_azure_machine_scale_set: vmが属するスケールセットの名前(スケールセットを使用している場合にのみ設定されます)
  • __meta_azure_machine_size: マシンサイズ
  • __meta_azure_subscription_id: サブスクリプションID
  • __meta_azure_tenant_id: テナントID

Azure検出の設定オプションについては、以下を参照してください。

# The information to access the Azure API.
# The Azure environment.
[ environment: <string> | default = AzurePublicCloud ]

# The authentication method, either OAuth, ManagedIdentity or SDK.
# See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview
# SDK authentication method uses environment variables by default.
# See https://learn.microsoft.com/en-us/azure/developer/go/azure-sdk-authentication
[ authentication_method: <string> | default = OAuth]
# The subscription ID. Always required.
subscription_id: <string>
# Optional tenant ID. Only required with authentication_method OAuth.
[ tenant_id: <string> ]
# Optional client ID. Only required with authentication_method OAuth.
[ client_id: <string> ]
# Optional client secret. Only required with authentication_method OAuth.
[ client_secret: <secret> ]

# Optional resource group name. Limits discovery to this resource group.
[ resource_group: <string> ]

# Refresh interval to re-read the instance list.
[ refresh_interval: <duration> | default = 300s ]

# The port to scrape metrics from. If using the public IP address, this must
# instead be specified in the relabeling rule.
[ port: <int> | default = 80 ]

# Authentication information used to authenticate to the Azure API.
# Note that `basic_auth`, `authorization` and `oauth2` options are
# mutually exclusive.
# `password` and `password_file` are mutually exclusive.

# Optional HTTP basic authentication information, currently not support by Azure.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration, currently not supported by Azure.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration, currently not supported by Azure.
oauth2:
  [ <oauth2> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

<consul_sd_config>

Consul SD設定を使用すると、ConsulのCatalog APIからスクレイプターゲットを取得できます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_consul_address: ターゲットのアドレス
  • __meta_consul_dc: ターゲットのデータセンター名
  • __meta_consul_health: サービスのヘルスステータス
  • __meta_consul_partition: サービスが登録されている管理パーティション名
  • __meta_consul_metadata_<key>: ターゲットの各ノードメタデータキー値
  • __meta_consul_node: ターゲットに定義されているノード名
  • __meta_consul_service_address: ターゲットのサービスアドレス
  • __meta_consul_service_id: ターゲットのサービスID
  • __meta_consul_service_metadata_<key>: ターゲットの各サービスメタデータキー値
  • __meta_consul_service_port: ターゲットのサービスポート
  • __meta_consul_service: ターゲットが属するサービスの名前
  • __meta_consul_tagged_address_<key>: ターゲットの各ノードタグ付きアドレスキー値
  • __meta_consul_tags: ターゲットのタグのリスト(タグセパレーターで結合)
# The information to access the Consul API. It is to be defined
# as the Consul documentation requires.
[ server: <host> | default = "localhost:8500" ]
# Prefix for URIs for when consul is behind an API gateway (reverse proxy).
[ path_prefix: <string> ]
[ token: <secret> ]
[ datacenter: <string> ]
# Namespaces are only supported in Consul Enterprise.
[ namespace: <string> ]
# Admin Partitions are only supported in Consul Enterprise.
[ partition: <string> ]
[ scheme: <string> | default = "http" ]
# The username and password fields are deprecated in favor of the basic_auth configuration.
[ username: <string> ]
[ password: <secret> ]

# A list of services for which targets are retrieved. If omitted, all services
# are scraped.
services:
  [ - <string> ]

# See https://www.consul.io/api/catalog.html#list-nodes-for-service to know more
# about the possible filters that can be used.

# An optional list of tags used to filter nodes for a given service. Services must contain all tags in the list.
tags:
  [ - <string> ]

# Node metadata key/value pairs to filter nodes for a given service.
[ node_meta:
  [ <string>: <string> ... ] ]

# The string by which Consul tags are joined into the tag label.
[ tag_separator: <string> | default = , ]

# Allow stale Consul results (see https://www.consul.io/api/features/consistency.html). Will reduce load on Consul.
[ allow_stale: <boolean> | default = true ]

# The time after which the provided names are refreshed.
# On large setup it might be a good idea to increase this value because the catalog will change all the time.
[ refresh_interval: <duration> | default = 30s ]

# Authentication information used to authenticate to the consul server.
# Note that `basic_auth`, `authorization` and `oauth2` options are
# mutually exclusive.
# `password` and `password_file` are mutually exclusive.

# Optional HTTP basic authentication information.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
oauth2:
  [ <oauth2> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

ターゲットをスクレイプするために使用されるIP番号とポートは、<__meta_consul_address>:<__meta_consul_service_port>として組み立てられます。ただし、一部のConsul設定では、関連するアドレスは__meta_consul_service_addressにあります。そのような場合、リラベル機能を使用して、特別な__address__ラベルを置き換えることができます。

リラベリングフェーズは、任意のラベルに基づいてサービスまたはノードをフィルター処理するための、推奨されるより強力な方法です。数千のサービスを持つユーザーにとって、ノード(現在、ノードメタデータと1つのタグで)のフィルタリングの基本的なサポートを持つConsul APIを直接使用することがより効率的になる場合があります。

<digitalocean_sd_config>

DigitalOcean SD設定を使用すると、DigitalOceanのDroplets APIからスクレイプターゲットを取得できます。このサービス検出はデフォルトでパブリックIPv4アドレスを使用しますが、Prometheus digitalocean-sd設定ファイルに示すように、リラベリングで変更できます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_digitalocean_droplet_id: ドロプレットのID
  • __meta_digitalocean_droplet_name: Dropletの名前
  • __meta_digitalocean_image: Dropletのイメージのスラッグ
  • __meta_digitalocean_image_name: Dropletのイメージの表示名
  • __meta_digitalocean_private_ipv4: DropletのプライベートIPv4アドレス
  • __meta_digitalocean_public_ipv4: DropletのパブリックIPv4アドレス
  • __meta_digitalocean_public_ipv6: DropletのパブリックIPv6アドレス
  • __meta_digitalocean_region: Dropletのリージョン
  • __meta_digitalocean_size: Dropletのサイズ
  • __meta_digitalocean_status: Dropletのステータス
  • __meta_digitalocean_features: Dropletの機能のカンマ区切りリスト
  • __meta_digitalocean_tags: Dropletのタグのカンマ区切りリスト
  • __meta_digitalocean_vpc: DropletのVPCのID
# Authentication information used to authenticate to the API server.
# Note that `basic_auth` and `authorization` options are
# mutually exclusive.
# password and password_file are mutually exclusive.

# Optional HTTP basic authentication information, not currently supported by DigitalOcean.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

# The port to scrape metrics from.
[ port: <int> | default = 80 ]

# The time after which the droplets are refreshed.
[ refresh_interval: <duration> | default = 60s ]

<docker_sd_config>

Docker SD設定により、Docker Engineホストからスクレイプ対象を取得できます。

このSDは「コンテナ」を検出し、コンテナが公開するように設定されている各ネットワークIPとポートごとにターゲットを作成します。

利用可能なメタラベル

  • __meta_docker_container_id: コンテナのID
  • __meta_docker_container_name: コンテナの名前
  • __meta_docker_container_network_mode: コンテナのネットワークモード
  • __meta_docker_container_label_<labelname>: コンテナの各ラベル(サポートされていない文字はアンダースコアに変換されます)
  • __meta_docker_network_id: ネットワークのID
  • __meta_docker_network_name: ネットワークの名前
  • __meta_docker_network_ingress: ネットワークがイングレスかどうか
  • __meta_docker_network_internal: ネットワークが内部ネットワークかどうか
  • __meta_docker_network_label_<labelname>: ネットワークの各ラベル(サポートされていない文字はアンダースコアに変換されます)
  • __meta_docker_network_scope: ネットワークのスコープ
  • __meta_docker_network_ip: このネットワークにおけるコンテナのIPアドレス
  • __meta_docker_port_private: コンテナのポート
  • __meta_docker_port_public: ポートマッピングが存在する場合の外部ポート
  • __meta_docker_port_public_ip: ポートマッピングが存在する場合のパブリックIPアドレス

Docker検出の設定オプションについては、以下を参照してください。

# Address of the Docker daemon.
host: <string>

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

# The port to scrape metrics from, when `role` is nodes, and for discovered
# tasks and services that don't have published ports.
[ port: <int> | default = 80 ]

# The host to use if the container is in host networking mode.
[ host_networking_host: <string> | default = "localhost" ]

# Sort all non-nil networks in ascending order based on network name and
# get the first network if the container has multiple networks defined, 
# thus avoiding collecting duplicate targets.
[ match_first_network: <boolean> | default = true ]

# Optional filters to limit the discovery process to a subset of available
# resources.
# The available filters are listed in the upstream documentation:
# https://docs.docker.com/engine/api/v1.40/#operation/ContainerList
[ filters:
  [ - name: <string>
      values: <string>, [...] ]

# The time after which the containers are refreshed.
[ refresh_interval: <duration> | default = 60s ]

# Authentication information used to authenticate to the Docker daemon.
# Note that `basic_auth` and `authorization` options are
# mutually exclusive.
# password and password_file are mutually exclusive.

# Optional HTTP basic authentication information.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

リラベリングフェーズは、コンテナをフィルタリングするための推奨されるより強力な方法です。数千ものコンテナを持つユーザーの場合、コンテナのフィルタリングの基本的なサポート(filtersを使用)を提供するDocker APIを直接使用した方が効率的です。

Docker EngineのPrometheusの設定例については、このPrometheus設定ファイルの例を参照してください。

<dockerswarm_sd_config>

Docker Swarm SD設定により、Docker Swarmエンジンからスクレイプ対象を取得できます。

ターゲットの検出には、次のいずれかのロールを設定できます。

services

servicesロールは、すべてのSwarmサービスを検出し、そのポートをターゲットとして公開します。サービスの公開ポートごとに、単一のターゲットが生成されます。サービスに公開ポートがない場合、SD設定で定義されたportパラメータを使用して、サービスごとにターゲットが作成されます。

利用可能なメタラベル

  • __meta_dockerswarm_service_id: サービスのID
  • __meta_dockerswarm_service_name: サービスの名前
  • __meta_dockerswarm_service_mode: サービスのモード
  • __meta_dockerswarm_service_endpoint_port_name: エンドポイントポートの名前(存在する場合)
  • __meta_dockerswarm_service_endpoint_port_publish_mode: エンドポイントポートの公開モード
  • __meta_dockerswarm_service_label_<labelname>: サービスの各ラベル(サポートされていない文字はアンダースコアに変換されます)
  • __meta_dockerswarm_service_task_container_hostname: ターゲットのコンテナホスト名(存在する場合)
  • __meta_dockerswarm_service_task_container_image: ターゲットのコンテナイメージ
  • __meta_dockerswarm_service_updating_status: サービスのステータス(存在する場合)
  • __meta_dockerswarm_network_id: ネットワークのID
  • __meta_dockerswarm_network_name: ネットワークの名前
  • __meta_dockerswarm_network_ingress: ネットワークがイングレスかどうか
  • __meta_dockerswarm_network_internal: ネットワークが内部ネットワークかどうか
  • __meta_dockerswarm_network_label_<labelname>: ネットワークの各ラベル(サポートされていない文字はアンダースコアに変換されます)
  • __meta_dockerswarm_network_scope: ネットワークのスコープ

tasks

tasksロールは、すべてのSwarmタスクを検出し、そのポートをターゲットとして公開します。タスクの公開ポートごとに、単一のターゲットが生成されます。タスクに公開ポートがない場合、SD設定で定義されたportパラメータを使用して、タスクごとにターゲットが作成されます。

利用可能なメタラベル

  • __meta_dockerswarm_container_label_<labelname>: コンテナの各ラベル(サポートされていない文字はアンダースコアに変換されます)
  • __meta_dockerswarm_task_id: タスクのID
  • __meta_dockerswarm_task_container_id: タスクのコンテナID
  • __meta_dockerswarm_task_desired_state: タスクの目標状態
  • __meta_dockerswarm_task_slot: タスクのスロット
  • __meta_dockerswarm_task_state: タスクの状態
  • __meta_dockerswarm_task_port_publish_mode: タスクポートの公開モード
  • __meta_dockerswarm_service_id: サービスのID
  • __meta_dockerswarm_service_name: サービスの名前
  • __meta_dockerswarm_service_mode: サービスのモード
  • __meta_dockerswarm_service_label_<labelname>: サービスの各ラベル(サポートされていない文字はアンダースコアに変換されます)
  • __meta_dockerswarm_network_id: ネットワークのID
  • __meta_dockerswarm_network_name: ネットワークの名前
  • __meta_dockerswarm_network_ingress: ネットワークがイングレスかどうか
  • __meta_dockerswarm_network_internal: ネットワークが内部ネットワークかどうか
  • __meta_dockerswarm_network_label_<labelname>: ネットワークの各ラベル(サポートされていない文字はアンダースコアに変換されます)
  • __meta_dockerswarm_network_label: ネットワークの各ラベル(サポートされていない文字はアンダースコアに変換されます)
  • __meta_dockerswarm_network_scope: ネットワークのスコープ
  • __meta_dockerswarm_node_id: ノードのID
  • __meta_dockerswarm_node_hostname: ノードのホスト名
  • __meta_dockerswarm_node_address: ノードのアドレス
  • __meta_dockerswarm_node_availability: ノードの可用性
  • __meta_dockerswarm_node_label_<labelname>: ノードの各ラベル(サポートされていない文字はアンダースコアに変換されます)
  • __meta_dockerswarm_node_platform_architecture: ノードのアーキテクチャ
  • __meta_dockerswarm_node_platform_os: ノードのオペレーティングシステム
  • __meta_dockerswarm_node_role: ノードのロール
  • __meta_dockerswarm_node_status: ノードのステータス

mode=hostで公開されているポートには、__meta_dockerswarm_network_*メタラベルは設定されません。

nodes

nodesロールは、Swarmノードを検出するために使用されます。

利用可能なメタラベル

  • __meta_dockerswarm_node_address: ノードのアドレス
  • __meta_dockerswarm_node_availability: ノードの可用性
  • __meta_dockerswarm_node_engine_version: ノードエンジンのバージョン
  • __meta_dockerswarm_node_hostname: ノードのホスト名
  • __meta_dockerswarm_node_id: ノードのID
  • __meta_dockerswarm_node_label_<labelname>: ノードの各ラベル(サポートされていない文字はアンダースコアに変換されます)
  • __meta_dockerswarm_node_manager_address: ノードのマネージャーコンポーネントのアドレス
  • __meta_dockerswarm_node_manager_leader: ノードのマネージャーコンポーネントのリーダーシップステータス(trueまたはfalse)
  • __meta_dockerswarm_node_manager_reachability: ノードのマネージャーコンポーネントの到達可能性
  • __meta_dockerswarm_node_platform_architecture: ノードのアーキテクチャ
  • __meta_dockerswarm_node_platform_os: ノードのオペレーティングシステム
  • __meta_dockerswarm_node_role: ノードのロール
  • __meta_dockerswarm_node_status: ノードのステータス

Docker Swarm検出の設定オプションについては、以下を参照してください。

# Address of the Docker daemon.
host: <string>

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

# Role of the targets to retrieve. Must be `services`, `tasks`, or `nodes`.
role: <string>

# The port to scrape metrics from, when `role` is nodes, and for discovered
# tasks and services that don't have published ports.
[ port: <int> | default = 80 ]

# Optional filters to limit the discovery process to a subset of available
# resources.
# The available filters are listed in the upstream documentation:
# Services: https://docs.docker.com/engine/api/v1.40/#operation/ServiceList
# Tasks: https://docs.docker.com/engine/api/v1.40/#operation/TaskList
# Nodes: https://docs.docker.com/engine/api/v1.40/#operation/NodeList
[ filters:
  [ - name: <string>
      values: <string>, [...] ]

# The time after which the service discovery data is refreshed.
[ refresh_interval: <duration> | default = 60s ]

# Authentication information used to authenticate to the Docker daemon.
# Note that `basic_auth` and `authorization` options are
# mutually exclusive.
# password and password_file are mutually exclusive.

# Optional HTTP basic authentication information.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

リラベリングフェーズは、タスク、サービス、またはノードをフィルタリングするための推奨されるより強力な方法です。数千ものタスクを持つユーザーの場合、ノードのフィルタリングの基本的なサポート(filtersを使用)を提供するSwarm APIを直接使用した方が効率的です。

Docker SwarmのPrometheusの設定例については、このPrometheus設定ファイルの例を参照してください。

<dns_sd_config>

DNSベースのサービス検出設定では、ターゲットのリストを検出するために定期的にクエリされるDNSドメイン名のセットを指定できます。問い合わせるDNSサーバーは、/etc/resolv.confから読み取られます。

このサービス検出方法は、基本的なDNS A、AAAA、MX、NS、SRVレコードクエリのみをサポートし、RFC6763で指定されている高度なDNS-SDアプローチはサポートしていません。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_dns_name: 検出されたターゲットを生成したレコード名。
  • __meta_dns_srv_record_target: SRVレコードのターゲットフィールド
  • __meta_dns_srv_record_port: SRVレコードのポートフィールド
  • __meta_dns_mx_record_target: MXレコードのターゲットフィールド
  • __meta_dns_ns_record_target: NSレコードのターゲットフィールド
# A list of DNS domain names to be queried.
names:
  [ - <string> ]

# The type of DNS query to perform. One of SRV, A, AAAA, MX or NS.
[ type: <string> | default = 'SRV' ]

# The port number used if the query type is not SRV.
[ port: <int>]

# The time after which the provided names are refreshed.
[ refresh_interval: <duration> | default = 30s ]

<ec2_sd_config>

EC2 SD設定により、AWS EC2インスタンスからスクレイプ対象を取得できます。デフォルトではプライベートIPアドレスが使用されますが、リラベリングでパブリックIPアドレスに変更できます。

使用するIAM認証情報には、スクレイプ対象を検出するためにec2:DescribeInstances権限が必要です。アベイラビリティゾーンIDをラベルとして使用したい場合は、オプションでec2:DescribeAvailabilityZones権限を付与できます(下記参照)。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_ec2_ami: EC2 Amazon Machine Image
  • __meta_ec2_architecture: インスタンスのアーキテクチャ
  • __meta_ec2_availability_zone: インスタンスが実行されているアベイラビリティゾーン
  • __meta_ec2_availability_zone_id: インスタンスが実行されているアベイラビリティゾーンIDec2:DescribeAvailabilityZonesが必要です)
  • __meta_ec2_instance_id: EC2インスタンスID
  • __meta_ec2_instance_lifecycle: EC2インスタンスのライフサイクル(スポットインスタンスまたはスケジュールインスタンスでのみ設定され、それ以外は存在しません)
  • __meta_ec2_instance_state: EC2インスタンスの状態
  • __meta_ec2_instance_type: EC2インスタンスの種類
  • __meta_ec2_ipv6_addresses: インスタンスのネットワークインターフェースに割り当てられたIPv6アドレスのカンマ区切りリスト(存在する場合)
  • __meta_ec2_owner_id: EC2インスタンスを所有するAWSアカウントのID
  • __meta_ec2_platform: オペレーティングシステムプラットフォーム(Windowsサーバーでは「windows」に設定され、それ以外は存在しません)
  • __meta_ec2_primary_ipv6_addresses: インスタンスのプライマリIPv6アドレスのカンマ区切りリスト(存在する場合)。このリストは、対応する各ネットワークインターフェースのアタッチメント順序に基づいてソートされます。
  • __meta_ec2_primary_subnet_id: プライマリネットワークインターフェースのサブネットID(存在する場合)
  • __meta_ec2_private_dns_name: インスタンスのプライベートDNS名(存在する場合)
  • __meta_ec2_private_ip: インスタンスのプライベートIPアドレス(存在する場合)
  • __meta_ec2_public_dns_name: インスタンスのパブリックDNS名(利用可能な場合)
  • __meta_ec2_public_ip: インスタンスのパブリックIPアドレス(利用可能な場合)
  • __meta_ec2_region: インスタンスのリージョン
  • __meta_ec2_subnet_id: インスタンスが実行されているサブネットIDのカンマ区切りリスト(利用可能な場合)
  • __meta_ec2_tag_<tagkey>: インスタンスの各タグ値
  • __meta_ec2_vpc_id: インスタンスが実行されているVPCのID(利用可能な場合)

EC2検出の構成オプションについては、以下を参照してください。

# The information to access the EC2 API.

# The AWS region. If blank, the region from the instance metadata is used.
[ region: <string> ]

# Custom endpoint to be used.
[ endpoint: <string> ]

# The AWS API keys. If blank, the environment variables `AWS_ACCESS_KEY_ID`
# and `AWS_SECRET_ACCESS_KEY` are used.
[ access_key: <string> ]
[ secret_key: <secret> ]
# Named AWS profile used to connect to the API.
[ profile: <string> ]

# AWS Role ARN, an alternative to using AWS API keys.
[ role_arn: <string> ]

# Refresh interval to re-read the instance list.
[ refresh_interval: <duration> | default = 60s ]

# The port to scrape metrics from. If using the public IP address, this must
# instead be specified in the relabeling rule.
[ port: <int> | default = 80 ]

# Filters can be used optionally to filter the instance list by other criteria.
# Available filter criteria can be found here:
# https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html
# Filter API documentation: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Filter.html
filters:
  [ - name: <string>
      values: <string>, [...] ]

# Authentication information used to authenticate to the EC2 API.
# Note that `basic_auth`, `authorization` and `oauth2` options are
# mutually exclusive.
# `password` and `password_file` are mutually exclusive.

# Optional HTTP basic authentication information, currently not supported by AWS.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration, currently not supported by AWS.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutuall exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration, currently not supported by AWS.
oauth2:
  [ <oauth2> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

リラベリングフェーズ は、任意のラベルに基づいてターゲットをフィルタリングするための推奨される、より強力な方法です。数千ものインスタンスを持つユーザーにとって、インスタンスのフィルタリングをサポートするEC2 APIを直接使用する方法がより効率的です。

<openstack_sd_config>

OpenStack SD構成により、OpenStack Novaインスタンスからスクレイプ対象を取得できます。

ターゲット検出のために、次の<openstack_role>タイプのいずれかを構成できます。

hypervisor

hypervisorロールは、Novaハイパーバイザーノードごとに1つのターゲットを検出します。ターゲットアドレスは、ハイパーバイザーのhost_ip属性にデフォルト設定されます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_openstack_hypervisor_host_ip: ハイパーバイザーノードのIPアドレス。
  • __meta_openstack_hypervisor_hostname: ハイパーバイザーノードの名前。
  • __meta_openstack_hypervisor_id: ハイパーバイザーノードのID。
  • __meta_openstack_hypervisor_state: ハイパーバイザーノードの状態。
  • __meta_openstack_hypervisor_status: ハイパーバイザーノードのステータス。
  • __meta_openstack_hypervisor_type: ハイパーバイザーノードのタイプ。

instance

instanceロールは、Novaインスタンスのネットワークインターフェースごとに1つのターゲットを検出します。ターゲットアドレスは、ネットワークインターフェースのプライベートIPアドレスにデフォルト設定されます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_openstack_address_pool: プライベートIPのプール。
  • __meta_openstack_instance_flavor: OpenStackインスタンスのフレーバー名、またはフレーバー名が利用できない場合はフレーバーID。
  • __meta_openstack_instance_id: OpenStackインスタンスID。
  • __meta_openstack_instance_image: OpenStackインスタンスで使用されているイメージのID。
  • __meta_openstack_instance_name: OpenStackインスタンス名。
  • __meta_openstack_instance_status: OpenStackインスタンスのステータス。
  • __meta_openstack_private_ip: OpenStackインスタンスのプライベートIP。
  • __meta_openstack_project_id: このインスタンスを所有するプロジェクト(テナント)。
  • __meta_openstack_public_ip: OpenStackインスタンスのパブリックIP。
  • __meta_openstack_tag_<key>: インスタンスの各メタデータ項目(サポートされていない文字はアンダースコアに変換されます)。
  • __meta_openstack_user_id: テナントを所有するユーザーアカウント。

OpenStack検出の構成オプションについては、以下を参照してください。

# The information to access the OpenStack API.

# The OpenStack role of entities that should be discovered.
role: <openstack_role>

# The OpenStack Region.
region: <string>

# identity_endpoint specifies the HTTP endpoint that is required to work with
# the Identity API of the appropriate version. While it's ultimately needed by
# all of the identity services, it will often be populated by a provider-level
# function.
[ identity_endpoint: <string> ]

# username is required if using Identity V2 API. Consult with your provider's
# control panel to discover your account's username. In Identity V3, either
# userid or a combination of username and domain_id or domain_name are needed.
[ username: <string> ]
[ userid: <string> ]

# password for the Identity V2 and V3 APIs. Consult with your provider's
# control panel to discover your account's preferred method of authentication.
[ password: <secret> ]

# At most one of domain_id and domain_name must be provided if using username
# with Identity V3. Otherwise, either are optional.
[ domain_name: <string> ]
[ domain_id: <string> ]

# The project_id and project_name fields are optional for the Identity V2 API.
# Some providers allow you to specify a project_name instead of the project_id.
# Some require both. Your provider's authentication policies will determine
# how these fields influence authentication.
[ project_name: <string> ]
[ project_id: <string> ]

# The application_credential_id or application_credential_name fields are
# required if using an application credential to authenticate. Some providers
# allow you to create an application credential to authenticate rather than a
# password.
[ application_credential_name: <string> ]
[ application_credential_id: <string> ]

# The application_credential_secret field is required if using an application
# credential to authenticate.
[ application_credential_secret: <secret> ]

# Whether the service discovery should list all instances for all projects.
# It is only relevant for the 'instance' role and usually requires admin permissions.
[ all_tenants: <boolean> | default: false ]

# Refresh interval to re-read the instance list.
[ refresh_interval: <duration> | default = 60s ]

# The port to scrape metrics from. If using the public IP address, this must
# instead be specified in the relabeling rule.
[ port: <int> | default = 80 ]

# The availability of the endpoint to connect to. Must be one of public, admin or internal.
[ availability: <string> | default = "public" ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

<ovhcloud_sd_config>

OVHcloud SD構成により、OVHcloudの専用サーバーVPSから、APIを使用してスクレイプ対象を取得できます。Prometheusは定期的にRESTエンドポイントをチェックし、検出された各サーバーのターゲットを作成します。このロールは、デフォルトアドレスとしてパブリックIPv4アドレスを使用しようとします。存在しない場合は、IPv6アドレスを使用しようとします。これは、リラベリングで変更できます。OVHcloudのパブリッククラウドインスタンスには、openstack_sd_configを使用できます。

VPS

  • __meta_ovhcloud_vps_cluster: サーバーのクラスタ
  • __meta_ovhcloud_vps_datacenter: サーバーのデータセンター
  • __meta_ovhcloud_vps_disk: サーバーのディスク
  • __meta_ovhcloud_vps_display_name: サーバーの表示名
  • __meta_ovhcloud_vps_ipv4: サーバーのIPv4
  • __meta_ovhcloud_vps_ipv6: サーバーのIPv6
  • __meta_ovhcloud_vps_keymap: サーバーのKVMキーボードレイアウト
  • __meta_ovhcloud_vps_maximum_additional_ip: サーバーの最大追加IP
  • __meta_ovhcloud_vps_memory_limit: サーバーのメモリ制限
  • __meta_ovhcloud_vps_memory: サーバーのメモリ
  • __meta_ovhcloud_vps_monitoring_ip_blocks: サーバーの監視IPブロック
  • __meta_ovhcloud_vps_name: サーバーの名前
  • __meta_ovhcloud_vps_netboot_mode: サーバーのネットブートモード
  • __meta_ovhcloud_vps_offer_type: サーバーのオファタイプ
  • __meta_ovhcloud_vps_offer: サーバーのオファー
  • __meta_ovhcloud_vps_state: サーバーの状態
  • __meta_ovhcloud_vps_vcore: サーバーの仮想コア数
  • __meta_ovhcloud_vps_version: サーバーのバージョン
  • __meta_ovhcloud_vps_zone: サーバーのゾーン

専用サーバー

  • __meta_ovhcloud_dedicated_server_commercial_range: サーバーの商用範囲
  • __meta_ovhcloud_dedicated_server_datacenter: サーバーのデータセンター
  • __meta_ovhcloud_dedicated_server_ipv4: サーバーのIPv4
  • __meta_ovhcloud_dedicated_server_ipv6: サーバーのIPv6
  • __meta_ovhcloud_dedicated_server_link_speed: サーバーのリンク速度
  • __meta_ovhcloud_dedicated_server_name: サーバーの名前
  • __meta_ovhcloud_dedicated_server_no_intervention: データセンターの介入がサーバーに対して無効になっているかどうか
  • __meta_ovhcloud_dedicated_server_os: サーバーのオペレーティングシステム
  • __meta_ovhcloud_dedicated_server_rack: サーバーのラック
  • __meta_ovhcloud_dedicated_server_reverse: サーバーのリバースDNS名
  • __meta_ovhcloud_dedicated_server_server_id: サーバーのID
  • __meta_ovhcloud_dedicated_server_state: サーバーの状態
  • __meta_ovhcloud_dedicated_server_support_level: サーバーのサポートレベル

OVHcloud検出の構成オプションについては、以下を参照してください。

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

<puppetdb_sd_config>

PuppetDB SD構成により、PuppetDBリソースからスクレイプ対象を取得できます。

このSDはリソースを検出し、APIによって返された各リソースのターゲットを作成します。

リソースアドレスはリソースのcertnameであり、リラベリング中に変更できます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_puppetdb_query: Puppet Query Language(PQL)クエリ
  • __meta_puppetdb_certname: リソースに関連付けられたノードの名前
  • __meta_puppetdb_resource: リソースの種類、タイトル、パラメーターのSHA-1ハッシュ(識別用)
  • __meta_puppetdb_type: リソースの種類
  • __meta_puppetdb_title: リソースのタイトル
  • __meta_puppetdb_exported: リソースがエクスポートされているかどうか("true"または"false"
  • __meta_puppetdb_tags: リソースタグのカンマ区切りリスト
  • __meta_puppetdb_file: リソースが宣言されたマニフェストファイル
  • __meta_puppetdb_environment: リソースに関連付けられたノードの環境
  • __meta_puppetdb_parameter_<parametername>: リソースのパラメーター

PuppetDB検出の構成オプションについては、以下を参照してください。

# The URL of the PuppetDB root query endpoint.
url: <string>

# Puppet Query Language (PQL) query. Only resources are supported.
# https://puppet.com/docs/puppetdb/latest/api/query/v4/pql.html
query: <string>

# Whether to include the parameters as meta labels.
# Due to the differences between parameter types and Prometheus labels,
# some parameters might not be rendered. The format of the parameters might
# also change in future releases.
#
# Note: Enabling this exposes parameters in the Prometheus UI and API. Make sure
# that you don't have secrets exposed as parameters if you enable this.
[ include_parameters: <boolean> | default = false ]

# Refresh interval to re-read the resources list.
[ refresh_interval: <duration> | default = 60s ]

# The port to scrape metrics from.
[ port: <int> | default = 80 ]

# TLS configuration to connect to the PuppetDB.
tls_config:
  [ <tls_config> ]

# basic_auth, authorization, and oauth2, are mutually exclusive.

# Optional HTTP basic authentication information.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# `Authorization` HTTP header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials with the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

この例のプロメテウス構成ファイルで、PuppetDBでプロメテウスを構成する詳細な例を参照してください。

<file_sd_config>

ファイルベースのサービス検出は、静的ターゲットを構成するためのより一般的な方法を提供し、カスタムサービス検出メカニズムをプラグインするためのインターフェースとして機能します。

0個以上の<static_config>のリストを含むファイルのセットを読み取ります。定義されたすべてのファイルへの変更は、ディスク監視を介して検出され、すぐに適用されます。

これらの個々のファイルは変更について監視されますが、親ディレクトリも暗黙的に監視されます。これは、アトミックな名前変更を効率的に処理し、構成されたglobに一致する新しいファイルを検出するためです。親ディレクトリに多数の他のファイルが含まれている場合、これらのファイルに関連するイベントは関連しないにもかかわらず、これらのファイルも監視されるため、問題が発生する可能性があります。

ファイルはYAMLまたはJSON形式で提供できます。適切な形式のターゲットグループをもたらす変更のみが適用されます。

ファイルには、これらの形式を使用した静的構成のリストを含める必要があります。

JSON

[
  {
    "targets": [ "<host>", ... ],
    "labels": {
      "<labelname>": "<labelvalue>", ...
    }
  },
  ...
]

YAML

- targets:
  [ - '<host>' ]
  labels:
    [ <labelname>: <labelvalue> ... ]

フォールバックとして、ファイルの内容は指定された更新間隔で定期的に再読み込みされます。

リラベリングフェーズ中に、各ターゲットにはメタラベル__meta_filepathがあります。その値は、ターゲットが抽出されたファイルパスに設定されます。

この検出メカニズムには、統合のリストがあります。

# Patterns for files from which target groups are extracted.
files:
  [ - <filename_pattern> ... ]

# Refresh interval to re-read the files.
[ refresh_interval: <duration> | default = 5m ]

ここで、<filename_pattern>.json.yml、または.yamlで終わるパスです。最後のパスセグメントには、任意の文字列に一致する単一の*を含めることができます(例:my/path/tg_*.json)。

<gce_sd_config>

GCE SD構成により、GCP GCEインスタンスからスクレイプ対象を取得できます。デフォルトではプライベートIPアドレスが使用されますが、リラベリングでパブリックIPアドレスに変更できます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_gce_instance_id: インスタンスの数値ID
  • __meta_gce_instance_name: インスタンスの名前
  • __meta_gce_label_<labelname>: インスタンスの各GCEラベル(サポートされていない文字はアンダースコアに変換されます)
  • __meta_gce_machine_type: インスタンスのマシンタイプの完全または部分的なURL
  • __meta_gce_metadata_<name>: インスタンスの各メタデータ項目
  • __meta_gce_network: インスタンスのネットワークURL
  • __meta_gce_private_ip: インスタンスのプライベートIPアドレス
  • __meta_gce_interface_ipv4_<name>: 各名前付きインターフェースのIPv4アドレス
  • __meta_gce_project: インスタンスが実行されているGCPプロジェクト
  • __meta_gce_public_ip: インスタンスのパブリックIPアドレス(存在する場合)
  • __meta_gce_subnetwork: インスタンスのサブネットワークURL
  • __meta_gce_tags: インスタンスタグのカンマ区切りリスト
  • __meta_gce_zone: インスタンスが実行されているGCEゾーンURL

GCE検出の構成オプションについては、以下を参照してください。

# The information to access the GCE API.

# The GCP Project
project: <string>

# The zone of the scrape targets. If you need multiple zones use multiple
# gce_sd_configs.
zone: <string>

# Filter can be used optionally to filter the instance list by other criteria
# Syntax of this filter string is described here in the filter query parameter section:
# https://cloud.google.com/compute/docs/reference/latest/instances/list
[ filter: <string> ]

# Refresh interval to re-read the instance list
[ refresh_interval: <duration> | default = 60s ]

# The port to scrape metrics from. If using the public IP address, this must
# instead be specified in the relabeling rule.
[ port: <int> | default = 80 ]

# The tag separator is used to separate the tags on concatenation
[ tag_separator: <string> | default = , ]

資格情報は、Google Cloud SDKのデフォルトクライアントによって、次の場所から検索され、最初に検出された場所が優先されます。

  1. GOOGLE_APPLICATION_CREDENTIALS環境変数で指定されたJSONファイル
  2. 既知のパス$HOME/.config/gcloud/application_default_credentials.jsonにあるJSONファイル
  3. GCEメタデータサーバーから取得

PrometheusがGCE内で実行されている場合、実行されているインスタンスに関連付けられたサービスアカウントには、少なくとも計算リソースに対する読み取り専用権限が必要です。GCE以外で実行する場合は、適切なサービスアカウントを作成し、資格情報ファイルを予期される場所のいずれかに配置してください。

<hetzner_sd_config>

Hetzner SD 設定では、Hetzner Cloud API と Robot API からスクレイプ対象を取得できます。このサービスディスカバリはデフォルトでパブリックIPv4アドレスを使用しますが、Prometheus の hetzner-sd 設定ファイル に示されているように、リラベリングで変更できます。

リラベリング中に、すべてのターゲットで以下のメタラベルが使用できます。リラベリング

  • __meta_hetzner_server_id: サーバーのID
  • __meta_hetzner_server_name: サーバーの名前
  • __meta_hetzner_server_status: サーバーのステータス
  • __meta_hetzner_public_ipv4: サーバーのパブリックIPv4アドレス
  • __meta_hetzner_public_ipv6_network: サーバーのパブリックIPv6ネットワーク(/64)
  • __meta_hetzner_datacenter: サーバーのデータセンター

以下のラベルは、rolehcloud に設定されているターゲットでのみ使用できます。

  • __meta_hetzner_hcloud_image_name: サーバーのイメージ名
  • __meta_hetzner_hcloud_image_description: サーバーイメージの説明
  • __meta_hetzner_hcloud_image_os_flavor: サーバーイメージのOSフレーバー
  • __meta_hetzner_hcloud_image_os_version: サーバーイメージのOSバージョン
  • __meta_hetzner_hcloud_datacenter_location: サーバーのロケーション
  • __meta_hetzner_hcloud_datacenter_location_network_zone: サーバーのネットワークゾーン
  • __meta_hetzner_hcloud_server_type: サーバーの種類
  • __meta_hetzner_hcloud_cpu_cores: サーバーのCPUコア数
  • __meta_hetzner_hcloud_cpu_type: サーバーのCPUの種類(共有または専用)
  • __meta_hetzner_hcloud_memory_size_gb: サーバーのメモリ容量(GB単位)
  • __meta_hetzner_hcloud_disk_size_gb: サーバーのディスクサイズ(GB単位)
  • __meta_hetzner_hcloud_private_ipv4_: 指定されたネットワーク内のサーバーのプライベートIPv4アドレス
  • __meta_hetzner_hcloud_label_: サーバーの各ラベル(サポートされていない文字はアンダースコアに変換されます)
  • __meta_hetzner_hcloud_labelpresent_: サーバーの各ラベルについてtrue(サポートされていない文字はアンダースコアに変換されます)

以下のラベルは、rolerobot に設定されているターゲットでのみ使用できます。

  • __meta_hetzner_robot_product: サーバーの製品
  • __meta_hetzner_robot_cancelled: サーバーのキャンセルステータス
# The Hetzner role of entities that should be discovered.
# One of robot or hcloud.
role: <string>

# Authentication information used to authenticate to the API server.
# Note that `basic_auth` and `authorization` options are
# mutually exclusive.
# password and password_file are mutually exclusive.

# Optional HTTP basic authentication information, required when role is robot
# Role hcloud does not support basic auth.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration, required when role is
# hcloud. Role robot does not support bearer token authentication.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

# The port to scrape metrics from.
[ port: <int> | default = 80 ]

# The time after which the servers are refreshed.
[ refresh_interval: <duration> | default = 60s ]

HTTPベースのサービスディスカバリは、静的ターゲットを設定するためのより一般的な方法を提供し、カスタムサービスディスカバリメカニズムをプラグインするためのインターフェースとして機能します。

0個以上のを含むHTTPエンドポイントからターゲットを取得します。ターゲットはHTTP 200レスポンスで応答する必要があります。HTTPヘッダーContent-Typeapplication/jsonでなければならず、本文は有効なJSONである必要があります。

レスポンス本文の例

[
  {
    "targets": [ "<host>", ... ],
    "labels": {
      "<labelname>": "<labelvalue>", ...
    }
  },
  ...
]

エンドポイントは、指定された更新間隔で定期的にクエリされます。prometheus_sd_http_failures_totalカウンターメトリックは、更新失敗の数を追跡します。

各ターゲットには、リラベリングフェーズ中にメタラベル__meta_urlがあります。その値は、ターゲットが抽出されたURLに設定されます。

# URL from which the targets are fetched.
url: <string>

# Refresh interval to re-query the endpoint.
[ refresh_interval: <duration> | default = 60s ]

# Authentication information used to authenticate to the API server.
# Note that `basic_auth`, `authorization` and `oauth2` options are
# mutually exclusive.
# `password` and `password_file` are mutually exclusive.

# Optional HTTP basic authentication information.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
oauth2:
  [ <oauth2> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

IONOS SD 設定では、IONOS Cloud API からスクレイプ対象を取得できます。このサービスディスカバリはデフォルトで最初のNICのIPアドレスを使用しますが、リラベリングで変更できます。リラベリング中に、すべてのターゲットで以下のメタラベルが使用できます。リラベリング

  • __meta_ionos_server_availability_zone: サーバーのアベイラビリティゾーン
  • __meta_ionos_server_boot_cdrom_id: サーバーがブートするCD-ROMのID
  • __meta_ionos_server_boot_image_id: サーバーがブートするブートイメージまたはスナップショットのID
  • __meta_ionos_server_boot_volume_id: ブートボリュームのID
  • __meta_ionos_server_cpu_family: サーバーのCPUファミリ
  • __meta_ionos_server_id: サーバーのID
  • __meta_ionos_server_ip: サーバーに割り当てられたすべてのIPのカンマ区切りリスト
  • __meta_ionos_server_lifecycle: サーバーリソースのライフサイクル状態
  • __meta_ionos_server_name: サーバーの名前
  • __meta_ionos_server_nic_ip_: サーバーに接続されている各NICの名前別にグループ化されたIPのカンマ区切りリスト
  • __meta_ionos_server_servers_id: サーバーが属するサーバーのID
  • __meta_ionos_server_state: サーバーの実行状態
  • __meta_ionos_server_type: サーバーの種類
# The unique ID of the data center.
datacenter_id: <string>

# Authentication information used to authenticate to the API server.
# Note that `basic_auth` and `authorization` options are
# mutually exclusive.
# password and password_file are mutually exclusive.

# Optional HTTP basic authentication information, required when using IONOS
# Cloud username and password as authentication method.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration, required when using IONOS
# Cloud token as authentication method.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

# The port to scrape metrics from.
[ port: <int> | default = 80 ]

# The time after which the servers are refreshed.
[ refresh_interval: <duration> | default = 60s ]

Kubernetes SD 設定では、Kubernetes の REST API からスクレイプ対象を取得し、常にクラスタの状態と同期した状態を維持できます。

ターゲットの検出には、以下のいずれかのroleタイプを設定できます。

node

nodeロールは、クラスタノードごとに1つのターゲットを検出し、アドレスはデフォルトでKubeletのHTTPポートになります。ターゲットアドレスは、Kubernetesノードオブジェクトの既存のアドレスのうち、NodeInternalIPNodeExternalIPNodeLegacyHostIPNodeHostNameの順序で最初に存在するアドレスになります。

利用可能なメタラベル

  • __meta_kubernetes_node_name: ノードオブジェクトの名前。
  • __meta_kubernetes_node_provider_id: ノードオブジェクトのクラウドプロバイダーの名前。
  • __meta_kubernetes_node_label_: ノードオブジェクトの各ラベル(サポートされていない文字はアンダースコアに変換されます)。
  • __meta_kubernetes_node_labelpresent_: ノードオブジェクトの各ラベルについてtrue(サポートされていない文字はアンダースコアに変換されます)。
  • __meta_kubernetes_node_annotation_: ノードオブジェクトの各アノテーション。
  • __meta_kubernetes_node_annotationpresent_: ノードオブジェクトの各アノテーションについてtrue
  • __meta_kubernetes_node_address_: 各ノードアドレスタイプについて、存在する場合は最初のアドレス。

さらに、ノードのinstanceラベルは、APIサーバーから取得したノード名に設定されます。

service

serviceロールは、サービスごとに各サービスポートのターゲットを検出します。これは、一般的にサービスのブラックボックス監視に役立ちます。アドレスは、サービスのKubernetes DNS名とそれぞれのサービスポートに設定されます。

利用可能なメタラベル

  • __meta_kubernetes_namespace: サービスオブジェクトの名前空間。
  • __meta_kubernetes_service_annotation_: サービスオブジェクトの各アノテーション。
  • __meta_kubernetes_service_annotationpresent_: サービスオブジェクトの各アノテーションについて"true"。
  • __meta_kubernetes_service_cluster_ip: サービスのクラスタIPアドレス。(ExternalNameタイプのサービスには適用されません)
  • __meta_kubernetes_service_loadbalancer_ip: ロードバランサーのIPアドレス。(LoadBalancerタイプのサービスに適用されます)
  • __meta_kubernetes_service_external_name: サービスのDNS名。(ExternalNameタイプのサービスに適用されます)
  • __meta_kubernetes_service_label_: サービスオブジェクトの各ラベル(サポートされていない文字はアンダースコアに変換されます)。
  • __meta_kubernetes_service_labelpresent_: サービスオブジェクトの各ラベルについてtrue(サポートされていない文字はアンダースコアに変換されます)。
  • __meta_kubernetes_service_name: サービスオブジェクトの名前。
  • __meta_kubernetes_service_port_name: ターゲットのサービスポート名。
  • __meta_kubernetes_service_port_number: ターゲットのサービスポート番号。
  • __meta_kubernetes_service_port_protocol: ターゲットのサービスポートのプロトコル。
  • __meta_kubernetes_service_type: サービスの種類。

pod

podロールは、すべてのポッドを検出し、そのコンテナをターゲットとして公開します。コンテナの宣言されたポートごとに、1つのターゲットが生成されます。コンテナに指定されたポートがない場合、リラベリングによって手動でポートを追加するために、コンテナごとにポートフリーのターゲットが作成されます。

利用可能なメタラベル

  • __meta_kubernetes_namespace: ポッドオブジェクトの名前空間。
  • __meta_kubernetes_pod_name: ポッドオブジェクトの名前。
  • __meta_kubernetes_pod_ip: ポッドオブジェクトのポッドIP。
  • __meta_kubernetes_pod_label_: ポッドオブジェクトの各ラベル(サポートされていない文字はアンダースコアに変換されます)。
  • __meta_kubernetes_pod_labelpresent_: ポッドオブジェクトの各ラベルについてtrue(サポートされていない文字はアンダースコアに変換されます)。
  • __meta_kubernetes_pod_annotation_: ポッドオブジェクトの各アノテーション。
  • __meta_kubernetes_pod_annotationpresent_: ポッドオブジェクトの各アノテーションについてtrue
  • __meta_kubernetes_pod_container_init: コンテナがInitContainerである場合true
  • __meta_kubernetes_pod_container_name: ターゲットアドレスが指すコンテナの名前。
  • __meta_kubernetes_pod_container_id: ターゲットアドレスが指すコンテナのID。IDは://の形式です。
  • __meta_kubernetes_pod_container_image: コンテナで使用されているイメージ。
  • __meta_kubernetes_pod_container_port_name: コンテナポートの名前。
  • __meta_kubernetes_pod_container_port_number: コンテナポートの番号。
  • __meta_kubernetes_pod_container_port_protocol: コンテナポートのプロトコル。
  • __meta_kubernetes_pod_ready: ポッドの準備状態についてtrueまたはfalseに設定されます。
  • __meta_kubernetes_pod_phase: ライフサイクルPendingRunningSucceededFailed、またはUnknownに設定されます。
  • __meta_kubernetes_pod_node_name: ポッドがスケジュールされているノードの名前。
  • __meta_kubernetes_pod_host_ip: ポッドオブジェクトの現在のホストIP。
  • __meta_kubernetes_pod_uid: ポッドオブジェクトのUID。
  • __meta_kubernetes_pod_controller_kind: ポッドコントローラーのオブジェクトの種類。
  • __meta_kubernetes_pod_controller_name: ポッドコントローラーの名前。

endpoints

endpointsロールは、サービスのリストされたエンドポイントからターゲットを検出します。エンドポイントアドレスごとに、ポートごとに1つのターゲットが検出されます。エンドポイントがポッドによってバックアップされている場合、エンドポイントポートにバインドされていないポッドの追加コンテナポートもターゲットとして検出されます。

利用可能なメタラベル

  • __meta_kubernetes_namespace: エンドポイントオブジェクトの名前空間。
  • __meta_kubernetes_endpoints_name: エンドポイントオブジェクトの名前。
  • __meta_kubernetes_endpoints_label_: エンドポイントオブジェクトの各ラベル(サポートされていない文字はアンダースコアに変換されます)。
  • __meta_kubernetes_endpoints_labelpresent_: エンドポイントオブジェクトの各ラベルについてtrue(サポートされていない文字はアンダースコアに変換されます)。
  • __meta_kubernetes_endpoints_annotation_: エンドポイントオブジェクトの各アノテーション。
  • __meta_kubernetes_endpoints_annotationpresent_: エンドポイントオブジェクトの各アノテーションについてtrue
  • エンドポイントリストから直接検出されたすべてのターゲット(基になるポッドから追加で推論されていないもの)には、以下のラベルが付けられます。
    • __meta_kubernetes_endpoint_hostname: エンドポイントのホスト名。
    • __meta_kubernetes_endpoint_node_name: エンドポイントをホストしているノードの名前。
    • __meta_kubernetes_endpoint_ready: エンドポイントの準備状態を表すtrueまたはfalse
    • __meta_kubernetes_endpoint_port_name: エンドポイントポートの名前。
    • __meta_kubernetes_endpoint_port_protocol: エンドポイントポートのプロトコル。
    • __meta_kubernetes_endpoint_address_target_kind: エンドポイントアドレスターゲットの種類。
    • __meta_kubernetes_endpoint_address_target_name: エンドポイントアドレスターゲットの名前。
  • エンドポイントがサービスに属している場合、role: service ディスカバリのすべてのラベルが添付されます。
  • ポッドによってバックアップされているすべてのターゲットに対して、role: pod ディスカバリのすべてのラベルが添付されます。

endpointslice

endpointsliceロールは、既存のendpointsliceからターゲットを検出します。endpointsliceオブジェクトで参照されている各エンドポイントアドレスに対して、1つのターゲットが検出されます。エンドポイントがポッドによってバックアップされている場合、エンドポイントポートにバインドされていないポッドの追加のコンテナポートもターゲットとして検出されます。

利用可能なメタラベル

  • __meta_kubernetes_namespace: エンドポイントオブジェクトの名前空間。
  • __meta_kubernetes_endpointslice_name: endpointsliceオブジェクトの名前。
  • __meta_kubernetes_endpointslice_label_<labelname>: endpointsliceオブジェクトの各ラベル。サポートされていない文字はアンダースコアに変換されます。
  • __meta_kubernetes_endpointslice_labelpresent_<labelname>: endpointsliceオブジェクトの各ラベルに対してtrue。サポートされていない文字はアンダースコアに変換されます。
  • __meta_kubernetes_endpointslice_annotation_<annotationname>: endpointsliceオブジェクトの各アノテーション。
  • __meta_kubernetes_endpointslice_annotationpresent_<annotationname>: endpointsliceオブジェクトの各アノテーションに対してtrue
  • endpointsliceリストから直接検出されたすべてのターゲット(基になるポッドから追加で推論されていないターゲット)には、次のラベルが添付されます。
    • __meta_kubernetes_endpointslice_address_target_kind: 参照対象オブジェクトの種類。
    • __meta_kubernetes_endpointslice_address_target_name: 参照対象オブジェクトの名前。
    • __meta_kubernetes_endpointslice_address_type: ターゲットのアドレスのIPプロトコルファミリ。
    • __meta_kubernetes_endpointslice_endpoint_conditions_ready: 参照対象エンドポイントの準備状態を表すtrueまたはfalse
    • __meta_kubernetes_endpointslice_endpoint_conditions_serving: 参照対象エンドポイントのサービス状態を表すtrueまたはfalse
    • __meta_kubernetes_endpointslice_endpoint_conditions_terminating: 参照対象エンドポイントの終了状態を表すtrueまたはfalse
    • __meta_kubernetes_endpointslice_endpoint_topology_kubernetes_io_hostname: 参照対象エンドポイントをホストしているノードの名前。
    • __meta_kubernetes_endpointslice_endpoint_topology_present_kubernetes_io_hostname: 参照対象オブジェクトにkubernetes.io/hostnameアノテーションがあるかどうかを示すフラグ。
    • __meta_kubernetes_endpointslice_endpoint_hostname: 参照対象エンドポイントのホスト名。
    • __meta_kubernetes_endpointslice_endpoint_node_name: 参照対象エンドポイントをホストしているノードの名前。
    • __meta_kubernetes_endpointslice_endpoint_zone: 参照対象エンドポイントが存在するゾーン(discovery.k8s.io/v1 APIグループを使用する場合のみ利用可能)。
    • __meta_kubernetes_endpointslice_port: 参照対象エンドポイントのポート。
    • __meta_kubernetes_endpointslice_port_name: 参照対象エンドポイントの名前付きポート。
    • __meta_kubernetes_endpointslice_port_protocol: 参照対象エンドポイントのプロトコル。
  • エンドポイントがサービスに属している場合、role: service ディスカバリのすべてのラベルが添付されます。
  • ポッドによってバックアップされているすべてのターゲットに対して、role: pod ディスカバリのすべてのラベルが添付されます。

ingress

ingressロールは、各イングレスの各パスに対してターゲットを検出します。これは一般的に、イングレスのブラックボックスモニタリングに役立ちます。アドレスは、イングレス仕様で指定されたホストに設定されます。

利用可能なメタラベル

  • __meta_kubernetes_namespace: イングレスオブジェクトの名前空間。
  • __meta_kubernetes_ingress_name: イングレスオブジェクトの名前。
  • __meta_kubernetes_ingress_label_<labelname>: イングレスオブジェクトの各ラベル。サポートされていない文字はアンダースコアに変換されます。
  • __meta_kubernetes_ingress_labelpresent_<labelname>: イングレスオブジェクトの各ラベルに対してtrue。サポートされていない文字はアンダースコアに変換されます。
  • __meta_kubernetes_ingress_annotation_<annotationname>: イングレスオブジェクトの各アノテーション。
  • __meta_kubernetes_ingress_annotationpresent_<annotationname>: イングレスオブジェクトの各アノテーションに対してtrue
  • __meta_kubernetes_ingress_class_name: イングレス仕様のクラス名(存在する場合)。
  • __meta_kubernetes_ingress_scheme: イングレスのプロトコルスキーム。TLS設定が設定されている場合はhttps。デフォルトはhttp
  • __meta_kubernetes_ingress_path: イングレス仕様のパス。デフォルトは/

Kubernetesディスカバリの構成オプションについては、以下を参照してください。

# The information to access the Kubernetes API.

# The API server addresses. If left empty, Prometheus is assumed to run inside
# of the cluster and will discover API servers automatically and use the pod's
# CA certificate and bearer token file at /var/run/secrets/kubernetes.io/serviceaccount/.
[ api_server: <host> ]

# The Kubernetes role of entities that should be discovered.
# One of endpoints, endpointslice, service, pod, node, or ingress.
role: <string>

# Optional path to a kubeconfig file.
# Note that api_server and kube_config are mutually exclusive.
[ kubeconfig_file: <filename> ]

# Optional authentication information used to authenticate to the API server.
# Note that `basic_auth` and `authorization` options are mutually exclusive.
# password and password_file are mutually exclusive.

# Optional HTTP basic authentication information.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

# Optional namespace discovery. If omitted, all namespaces are used.
namespaces:
  own_namespace: <boolean>
  names:
    [ - <string> ]

# Optional label and field selectors to limit the discovery process to a subset of available resources.
# See https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/
# and https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ to learn more about the possible
# filters that can be used. The endpoints role supports pod, service and endpoints selectors.
# The pod role supports node selectors when configured with `attach_metadata: {node: true}`.
# Other roles only support selectors matching the role itself (e.g. node role can only contain node selectors).

# Note: When making decision about using field/label selector make sure that this
# is the best approach - it will prevent Prometheus from reusing single list/watch
# for all scrape configs. This might result in a bigger load on the Kubernetes API,
# because per each selector combination there will be additional LIST/WATCH. On the other hand,
# if you just want to monitor small subset of pods in large cluster it's recommended to use selectors.
# Decision, if selectors should be used or not depends on the particular situation.
[ selectors:
  [ - role: <string>
    [ label: <string> ]
    [ field: <string> ] ]]

# Optional metadata to attach to discovered targets. If omitted, no additional metadata is attached.
attach_metadata:
# Attaches node metadata to discovered targets. Valid for roles: pod, endpoints, endpointslice.
# When set to true, Prometheus must have permissions to get Nodes.
  [ node: <boolean> | default = false ]

Kubernetes用Prometheusの構成の詳細な例については、このPrometheus構成ファイルの例を参照してください。

Kubernetes上にPrometheusのセットアップを自動化するサードパーティ製のPrometheus Operatorも検討することをお勧めします。

<kuma_sd_config>

Kuma SD構成により、Kumaコントロールプレーンからスクレイプターゲットを取得できます。

このSDは、Kuma データプレーン プロキシに基づいて、MADS v1(Monitoring Assignment Discovery Service)xDS APIを介して「モニタリング割り当て」を検出し、Prometheus対応メッシュ内の各プロキシに対してターゲットを作成します。

各ターゲットには、次のメタラベルを使用できます。

  • __meta_kuma_mesh: プロキシのメッシュの名前。
  • __meta_kuma_dataplane: プロキシの名前。
  • __meta_kuma_service: プロキシに関連付けられているサービスの名前。
  • __meta_kuma_label_<tagname>: プロキシの各タグ。

Kumaモニタリング割り当てディスカバリの構成オプションについては、以下を参照してください。

# Address of the Kuma Control Plane's MADS xDS server.
server: <string>

# Client id is used by Kuma Control Plane to compute Monitoring Assignment for specific Prometheus backend. 
# This is useful when migrating between multiple Prometheus backends, or having separate backend for each Mesh.
# When not specified, system hostname/fqdn will be used if available, if not `prometheus` will be used.
[ client_id: <string> ]

# The time to wait between polling update requests.
[ refresh_interval: <duration> | default = 30s ]

# The time after which the monitoring assignments are refreshed.
[ fetch_timeout: <duration> | default = 2m ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

# Authentication information used to authenticate to the Docker daemon.
# Note that `basic_auth` and `authorization` options are
# mutually exclusive.
# password and password_file are mutually exclusive.

# Optional HTTP basic authentication information.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional the `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials with the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

プロキシとユーザー定義タグをフィルタリングするための、より好ましい、より強力な方法としてリラベリングフェーズがあります。

<lightsail_sd_config>

Lightsail SD構成により、AWS Lightsailインスタンスからスクレイプターゲットを取得できます。デフォルトではプライベートIPアドレスが使用されますが、リラベリングを使用してパブリックIPアドレスに変更できます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_lightsail_availability_zone: インスタンスが実行されているアベイラビリティゾーン。
  • __meta_lightsail_blueprint_id: LightsailブループリントID。
  • __meta_lightsail_bundle_id: LightsailバンドルID。
  • __meta_lightsail_instance_name: Lightsailインスタンスの名前。
  • __meta_lightsail_instance_state: Lightsailインスタンスの状態。
  • __meta_lightsail_instance_support_code: Lightsailインスタンスのサポートコード。
  • __meta_lightsail_ipv6_addresses: インスタンスのネットワークインターフェースに割り当てられたIPv6アドレスのカンマ区切りリスト(存在する場合)。
  • __meta_lightsail_private_ip: インスタンスのプライベートIPアドレス。
  • __meta_lightsail_public_ip: インスタンスのパブリックIPアドレス(利用可能な場合)。
  • __meta_lightsail_region: インスタンスのリージョン。
  • __meta_lightsail_tag_<tagkey>: インスタンスの各タグ値。

Lightsailディスカバリの構成オプションについては、以下を参照してください。

# The information to access the Lightsail API.

# The AWS region. If blank, the region from the instance metadata is used.
[ region: <string> ]

# Custom endpoint to be used.
[ endpoint: <string> ]

# The AWS API keys. If blank, the environment variables `AWS_ACCESS_KEY_ID`
# and `AWS_SECRET_ACCESS_KEY` are used.
[ access_key: <string> ]
[ secret_key: <secret> ]
# Named AWS profile used to connect to the API.
[ profile: <string> ]

# AWS Role ARN, an alternative to using AWS API keys.
[ role_arn: <string> ]

# Refresh interval to re-read the instance list.
[ refresh_interval: <duration> | default = 60s ]

# The port to scrape metrics from. If using the public IP address, this must
# instead be specified in the relabeling rule.
[ port: <int> | default = 80 ]

# Authentication information used to authenticate to the Lightsail API.
# Note that `basic_auth`, `authorization` and `oauth2` options are
# mutually exclusive.
# `password` and `password_file` are mutually exclusive.

# Optional HTTP basic authentication information, currently not supported by AWS.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration, currently not supported by AWS.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutuall exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration, currently not supported by AWS.
oauth2:
  [ <oauth2> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

<linode_sd_config>

Linode SD構成により、LinodeのLinode APIv4からスクレイプターゲットを取得できます。このサービスディスカバリはデフォルトでパブリックIPv4アドレスを使用しますが、Prometheus linode-sd構成ファイルで示されているように、リラベリングで変更できます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_linode_instance_id: LinodeインスタンスのID。
  • __meta_linode_instance_label: Linodeインスタンスのラベル。
  • __meta_linode_image: Linodeインスタンスのイメージのスラッグ。
  • __meta_linode_private_ipv4: LinodeインスタンスのプライベートIPv4。
  • __meta_linode_public_ipv4: LinodeインスタンスのパブリックIPv4。
  • __meta_linode_public_ipv6: LinodeインスタンスのパブリックIPv6。
  • __meta_linode_private_ipv4_rdns: Linodeインスタンスの最初のプライベートIPv4のリバースDNS。
  • __meta_linode_public_ipv4_rdns: Linodeインスタンスの最初のパブリックIPv4のリバースDNS。
  • __meta_linode_public_ipv6_rdns: Linodeインスタンスの最初のパブリックIPv6のリバースDNS。
  • __meta_linode_region: Linodeインスタンスのリージョン。
  • __meta_linode_type: Linodeインスタンスの種類。
  • __meta_linode_status: Linodeインスタンスの状態。
  • __meta_linode_tags: タグセパレータで結合されたLinodeインスタンスのタグのリスト。
  • __meta_linode_group: Linodeインスタンスがメンバーである表示グループ。
  • __meta_linode_gpus: LinodeインスタンスのGPU数。
  • __meta_linode_hypervisor: Linodeインスタンスを動作させる仮想化ソフトウェア。
  • __meta_linode_backups: Linodeインスタンスのバックアップサービスの状態。
  • __meta_linode_specs_disk_bytes: Linodeインスタンスがアクセスできるストレージ容量。
  • __meta_linode_specs_memory_bytes: LinodeインスタンスがアクセスできるRAM容量。
  • __meta_linode_specs_vcpus: このLinodeがアクセスできるVCPU数。
  • __meta_linode_specs_transfer_bytes: Linodeインスタンスに毎月割り当てられるネットワーク転送量。
  • __meta_linode_extra_ips: タグセパレータで結合された、Linodeインスタンスに割り当てられたすべての追加IPv4アドレスのリスト。
  • __meta_linode_ipv6_ranges: タグセパレータで結合された、Linodeインスタンスに割り当てられたIPv6範囲とマスクのリスト。
# Authentication information used to authenticate to the API server.
# Note that `basic_auth` and `authorization` options are
# mutually exclusive.
# password and password_file are mutually exclusive.
# Note: Linode APIv4 Token must be created with scopes: 'linodes:read_only', 'ips:read_only', and 'events:read_only'

# Optional HTTP basic authentication information, not currently supported by Linode APIv4.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional the `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials with the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Optional region to filter on.
[ region: <string> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

# The port to scrape metrics from.
[ port: <int> | default = 80 ]

# The string by which Linode Instance tags are joined into the tag label.
[ tag_separator: <string> | default = , ]

# The time after which the linode instances are refreshed.
[ refresh_interval: <duration> | default = 60s ]

<marathon_sd_config>

Marathon SD構成により、Marathon REST APIを使用してスクレイプターゲットを取得できます。Prometheusは定期的にRESTエンドポイントをチェックして、現在実行中のタスクを確認し、少なくとも1つの正常なタスクを持つすべてのアプリに対してターゲットグループを作成します。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_marathon_app: アプリの名前(スラッシュはダッシュに置き換えられます)。
  • __meta_marathon_image: 使用されるDockerイメージの名前(利用可能な場合)。
  • __meta_marathon_task: MesosタスクのID。
  • __meta_marathon_app_label_<labelname>: アプリに添付されているMarathonラベル。サポートされていない文字はアンダースコアに変換されます。
  • __meta_marathon_port_definition_label_<labelname>: ポート定義ラベル。サポートされていない文字はアンダースコアに変換されます。
  • __meta_marathon_port_mapping_label_<labelname>: ポートマッピングラベル。サポートされていない文字はアンダースコアに変換されます。
  • __meta_marathon_port_index: ポートインデックス番号(例:PORT1の場合は1)。

Marathonディスカバリの構成オプションについては、以下を参照してください。

# List of URLs to be used to contact Marathon servers.
# You need to provide at least one server URL.
servers:
  - <string>

# Polling interval
[ refresh_interval: <duration> | default = 30s ]

# Optional authentication information for token-based authentication
# https://docs.mesosphere.com/1.11/security/ent/iam-api/#passing-an-authentication-token
# It is mutually exclusive with `auth_token_file` and other authentication mechanisms.
[ auth_token: <secret> ]

# Optional authentication information for token-based authentication
# https://docs.mesosphere.com/1.11/security/ent/iam-api/#passing-an-authentication-token
# It is mutually exclusive with `auth_token` and other authentication mechanisms.
[ auth_token_file: <filename> ]

# Sets the `Authorization` header on every request with the
# configured username and password.
# This is mutually exclusive with other authentication mechanisms.
# password and password_file are mutually exclusive.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration.
# NOTE: The current version of DC/OS marathon (v1.11.0) does not support
# standard `Authentication` header, use `auth_token` or `auth_token_file`
# instead.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# TLS configuration for connecting to marathon servers
tls_config:
  [ <tls_config> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

デフォルトでは、MarathonにリストされているすべてのアプリがPrometheusによってスクレイプされます。すべてのサービスがPrometheusメトリクスを提供するわけではない場合、MarathonラベルとPrometheusのリラベリングを使用して、実際にスクレイプされるインスタンスを制御できます。Prometheus marathon-sd構成ファイルで、MarathonアプリとPrometheus構成を設定する方法の実例を参照してください。

デフォルトでは、Marathonにリストされているすべてのアプリは、Prometheusの単一のジョブ(構成ファイルで指定されたもの)として表示されます。これは、リラベリングを使用して変更することもできます。

<nerve_sd_config>

Nerve SD構成により、AirBnBのNerveZookeeperに保存されている)からスクレイプターゲットを取得できます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_nerve_path: Zookeeper内のエンドポイントノードへのフルパス。
  • __meta_nerve_endpoint_host: エンドポイントのホスト。
  • __meta_nerve_endpoint_port: エンドポイントのポート。
  • __meta_nerve_endpoint_name: エンドポイントの名前。
# The Zookeeper servers.
servers:
  - <host>
# Paths can point to a single service, or the root of a tree of services.
paths:
  - <string>
[ timeout: <duration> | default = 10s ]

<nomad_sd_config>

Nomad SD構成により、NomadのサービスAPIからスクレイプターゲットを取得できます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_nomad_address: ターゲットのサービスアドレス。
  • __meta_nomad_dc: ターゲットのデータセンター名。
  • __meta_nomad_namespace: ターゲットの名前空間。
  • __meta_nomad_node_id: ターゲットに定義されたノード名。
  • __meta_nomad_service: ターゲットが属するサービスの名前。
  • __meta_nomad_service_address: ターゲットのサービスアドレス。
  • __meta_nomad_service_id: ターゲットのサービスID。
  • __meta_nomad_service_port: ターゲットのサービスポート。
  • __meta_nomad_tags: タグ区切り記号で結合されたターゲットのタグ一覧
# The information to access the Nomad API. It is to be defined
# as the Nomad documentation requires.
[ allow_stale: <boolean> | default = true ]
[ namespace: <string> | default = default ]
[ refresh_interval: <duration> | default = 60s ]
[ region: <string> | default = global ]
[ server: <host> ]
[ tag_separator: <string> | default = ,]

# Authentication information used to authenticate to the nomad server.
# Note that `basic_auth`, `authorization` and `oauth2` options are
# mutually exclusive.
# `password` and `password_file` are mutually exclusive.

# Optional HTTP basic authentication information.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
oauth2:
  [ <oauth2> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

<serverset_sd_config>

Serverset SD設定により、ServersetsZookeeperに保存されている)からスクレイプ対象を取得できます。Serversetsは一般的にFinagleAuroraで使用されます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_serverset_path: Zookeeper内のServersetメンバーノードへの完全パス
  • __meta_serverset_endpoint_host: デフォルトエンドポイントのホスト
  • __meta_serverset_endpoint_port: デフォルトエンドポイントのポート
  • __meta_serverset_endpoint_host_<endpoint>: 指定されたエンドポイントのホスト
  • __meta_serverset_endpoint_port_<endpoint>: 指定されたエンドポイントのポート
  • __meta_serverset_shard: メンバーのシャード番号
  • __meta_serverset_status: メンバーの状態
# The Zookeeper servers.
servers:
  - <host>
# Paths can point to a single serverset, or the root of a tree of serversets.
paths:
  - <string>
[ timeout: <duration> | default = 10s ]

ServersetデータはJSON形式である必要があります。Thrift形式は現在サポートされていません。

<triton_sd_config>

Triton SD設定により、Container Monitor検出エンドポイントからスクレイプ対象を取得できます。

ターゲットの検出には、以下の<triton_role>タイプのいずれかを設定できます。

container

containerロールは、accountが所有する「仮想マシン」ごとに1つのターゲットを検出します。これらはSmartOSゾーンまたはlx/KVM/bhyveブランドのゾーンです。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_triton_groups: カンマ区切りで結合されたターゲットに属するグループ一覧
  • __meta_triton_machine_alias: ターゲットコンテナのエイリアス
  • __meta_triton_machine_brand: ターゲットコンテナのブランド
  • __meta_triton_machine_id: ターゲットコンテナのUUID
  • __meta_triton_machine_image: ターゲットコンテナのイメージタイプ
  • __meta_triton_server_id: ターゲットコンテナが実行されているサーバーのUUID

cn

cnロールは、Tritonインフラストラクチャを構成するコンピュートノード(「サーバー」または「グローバルゾーン」とも呼ばれる)ごとに1つのターゲットを検出します。accountはTritonオペレーターである必要があり、現在、少なくとも1つのcontainerを所有している必要があります。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_triton_machine_alias: ターゲットのホスト名(triton-cmon 1.7.0以降が必要です)
  • __meta_triton_machine_id: ターゲットのUUID

Triton検出の設定オプションについては、以下を参照してください。

# The information to access the Triton discovery API.

# The account to use for discovering new targets.
account: <string>

# The type of targets to discover, can be set to:
# * "container" to discover virtual machines (SmartOS zones, lx/KVM/bhyve branded zones) running on Triton
# * "cn" to discover compute nodes (servers/global zones) making up the Triton infrastructure
[ role : <string> | default = "container" ]

# The DNS suffix which should be applied to target.
dns_suffix: <string>

# The Triton discovery endpoint (e.g. 'cmon.us-east-3b.triton.zone'). This is
# often the same value as dns_suffix.
endpoint: <string>

# A list of groups for which targets are retrieved, only supported when `role` == `container`.
# If omitted all containers owned by the requesting account are scraped.
groups:
  [ - <string> ... ]

# The port to use for discovery and metric scraping.
[ port: <int> | default = 9163 ]

# The interval which should be used for refreshing targets.
[ refresh_interval: <duration> | default = 60s ]

# The Triton discovery API version.
[ version: <int> | default = 1 ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

<eureka_sd_config>

Eureka SD設定により、Eureka REST APIを使用してスクレイプ対象を取得できます。Prometheusは定期的にRESTエンドポイントをチェックし、各アプリインスタンスのターゲットを作成します。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_eureka_app_name: アプリの名前
  • __meta_eureka_app_instance_id: アプリインスタンスのID
  • __meta_eureka_app_instance_hostname: インスタンスのホスト名
  • __meta_eureka_app_instance_homepage_url: アプリインスタンスのホームページURL
  • __meta_eureka_app_instance_statuspage_url: アプリインスタンスのステータスページURL
  • __meta_eureka_app_instance_healthcheck_url: アプリインスタンスのヘルスチェックURL
  • __meta_eureka_app_instance_ip_addr: アプリインスタンスのIPアドレス
  • __meta_eureka_app_instance_vip_address: アプリインスタンスのVIPアドレス
  • __meta_eureka_app_instance_secure_vip_address: アプリインスタンスのセキュアVIPアドレス
  • __meta_eureka_app_instance_status: アプリインスタンスの状態
  • __meta_eureka_app_instance_port: アプリインスタンスのポート
  • __meta_eureka_app_instance_port_enabled: アプリインスタンスのポート有効化状態
  • __meta_eureka_app_instance_secure_port: アプリインスタンスのセキュアポートアドレス
  • __meta_eureka_app_instance_secure_port_enabled: アプリインスタンスのセキュアポート有効化状態
  • __meta_eureka_app_instance_country_id: アプリインスタンスの国ID
  • __meta_eureka_app_instance_metadata_<metadataname>: アプリインスタンスメタデータ
  • __meta_eureka_app_instance_datacenterinfo_name: アプリインスタンスのデータセンター名
  • __meta_eureka_app_instance_datacenterinfo_<metadataname>: データセンターメタデータ

Eureka検出の設定オプションについては、以下を参照してください。

# The URL to connect to the Eureka server.
server: <string>

# Sets the `Authorization` header on every request with the
# configured username and password.
# password and password_file are mutually exclusive.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Configures the scrape request's TLS settings.
tls_config:
  [ <tls_config> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# Refresh interval to re-read the app instance list.
[ refresh_interval: <duration> | default = 30s ]

EurekaアプリとPrometheus設定のセットアップ方法の実例については、Prometheus eureka-sd設定ファイルを参照してください。

<scaleway_sd_config>

Scaleway SD設定により、Scalewayインスタンスベアメタルサービスからスクレイプ対象を取得できます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

インスタンスロール

  • __meta_scaleway_instance_boot_type: サーバーのブートタイプ
  • __meta_scaleway_instance_hostname: サーバーのホスト名
  • __meta_scaleway_instance_id: サーバーのID
  • __meta_scaleway_instance_image_arch: サーバーイメージのアーキテクチャ
  • __meta_scaleway_instance_image_id: サーバーイメージのID
  • __meta_scaleway_instance_image_name: サーバーイメージの名前
  • __meta_scaleway_instance_location_cluster_id: サーバーロケーションのクラスタID
  • __meta_scaleway_instance_location_hypervisor_id: サーバーロケーションのハイパーバイザーID
  • __meta_scaleway_instance_location_node_id: サーバーロケーションのノードID
  • __meta_scaleway_instance_name: サーバーの名前
  • __meta_scaleway_instance_organization_id: サーバーの組織
  • __meta_scaleway_instance_private_ipv4: サーバーのプライベートIPv4アドレス
  • __meta_scaleway_instance_project_id: サーバーのプロジェクトID
  • __meta_scaleway_instance_public_ipv4: サーバーのパブリックIPv4アドレス
  • __meta_scaleway_instance_public_ipv6: サーバーのパブリックIPv6アドレス
  • __meta_scaleway_instance_region: サーバーのリージョン
  • __meta_scaleway_instance_security_group_id: サーバーのセキュリティグループのID
  • __meta_scaleway_instance_security_group_name: サーバーのセキュリティグループの名前
  • __meta_scaleway_instance_status: サーバーの状態
  • __meta_scaleway_instance_tags: タグ区切り記号で結合されたサーバーのタグ一覧
  • __meta_scaleway_instance_type: サーバーの商用タイプ
  • __meta_scaleway_instance_zone: サーバーのゾーン(例: fr-par-1、完全なリストはこちら

このロールは、プライベートIPv4、パブリックIPv4、パブリックIPv6の順に最初に検出されたアドレスを使用します。Prometheus scaleway-sd設定ファイルに示すように、リラベリングで変更できます。リラベリング前にインスタンスにアドレスがない場合、ターゲットリストに追加されず、リラベリングできなくなります。

ベアメタルロール

  • __meta_scaleway_baremetal_id: サーバーのID
  • __meta_scaleway_baremetal_public_ipv4: サーバーのパブリックIPv4アドレス
  • __meta_scaleway_baremetal_public_ipv6: サーバーのパブリックIPv6アドレス
  • __meta_scaleway_baremetal_name: サーバーの名前
  • __meta_scaleway_baremetal_os_name: サーバーのオペレーティングシステムの名前
  • __meta_scaleway_baremetal_os_version: サーバーのオペレーティングシステムのバージョン
  • __meta_scaleway_baremetal_project_id: サーバーのプロジェクトID
  • __meta_scaleway_baremetal_status: サーバーの状態
  • __meta_scaleway_baremetal_tags: タグ区切り記号で結合されたサーバーのタグ一覧
  • __meta_scaleway_baremetal_type: サーバーの商用タイプ
  • __meta_scaleway_baremetal_zone: サーバーのゾーン(例: fr-par-1、完全なリストはこちら

このロールはデフォルトでパブリックIPv4アドレスを使用します。Prometheus scaleway-sd設定ファイルに示すように、リラベリングで変更できます。

Scaleway検出の設定オプションについては、以下を参照してください。

# Access key to use. https://console.scaleway.com/project/credentials
access_key: <string>

# Secret key to use when listing targets. https://console.scaleway.com/project/credentials
# It is mutually exclusive with `secret_key_file`.
[ secret_key: <secret> ]

# Sets the secret key with the credentials read from the configured file.
# It is mutually exclusive with `secret_key`.
[ secret_key_file: <filename> ]

# Project ID of the targets.
project_id: <string>

# Role of the targets to retrieve. Must be `instance` or `baremetal`.
role: <string>

# The port to scrape metrics from.
[ port: <int> | default = 80 ]

# API URL to use when doing the server listing requests.
[ api_url: <string> | default = "https://api.scaleway.com" ]

# Zone is the availability zone of your targets (e.g. fr-par-1).
[ zone: <string> | default = fr-par-1 ]

# NameFilter specify a name filter (works as a LIKE) to apply on the server listing request.
[ name_filter: <string> ]

# TagsFilter specify a tag filter (a server needs to have all defined tags to be listed) to apply on the server listing request.
tags_filter:
[ - <string> ]

# Refresh interval to re-read the targets list.
[ refresh_interval: <duration> | default = 60s ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

<uyuni_sd_config>

Uyuni SD設定により、Uyuni APIを介して管理対象システムからスクレイプ対象を取得できます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_uyuni_endpoint_name: アプリケーションエンドポイントの名前
  • __meta_uyuni_exporter: ターゲットのメトリクスを公開するエクスポーター
  • __meta_uyuni_groups: ターゲットのシステムグループ
  • __meta_uyuni_metrics_path: ターゲットのメトリクスパス
  • __meta_uyuni_minion_hostname: Uyuniクライアントのホスト名
  • __meta_uyuni_primary_fqdn: UyuniクライアントのプライマリFQDN
  • __meta_uyuni_proxy_module: ターゲットに対してExporter Exporterプロキシが設定されている場合のモジュール名
  • __meta_uyuni_scheme: 要求に使用されるプロトコルスキーム
  • __meta_uyuni_system_id: クライアントのシステムID

Uyuni検出の設定オプションについては、以下を参照してください。

# The URL to connect to the Uyuni server.
server: <string>

# Credentials are used to authenticate the requests to Uyuni API.
username: <string>
password: <secret>

# The entitlement string to filter eligible systems.
[ entitlement: <string> | default = monitoring_entitled ]

# The string by which Uyuni group names are joined into the groups label.
[ separator: <string> | default = , ]

# Refresh interval to re-read the managed targets list.
[ refresh_interval: <duration> | default = 60s ]

# Optional HTTP basic authentication information, currently not supported by Uyuni.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration, currently not supported by Uyuni.
authorization:
  # Sets the authentication type.
    [ type: <string> | default: Bearer ]
    # Sets the credentials. It is mutually exclusive with
    # `credentials_file`.
    [ credentials: <secret> ]
    # Sets the credentials to the credentials read from the configured file.
    # It is mutually exclusive with `credentials`.
    [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration, currently not supported by Uyuni.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

Uyuni Prometheus設定のセットアップ方法の実例については、Prometheus uyuni-sd設定ファイルを参照してください。

<vultr_sd_config>

Vultr SD設定により、Vultrからスクレイプ対象を取得できます。

このサービス検出はデフォルトでメインIPv4アドレスを使用します。Prometheus vultr-sd設定ファイルに示すように、リラベリングで変更できます。

リラベリング時に、ターゲットで使用できるメタラベルを以下に示します。

  • __meta_vultr_instance_id: Vultrインスタンスの一意のID。
  • __meta_vultr_instance_label: このインスタンスにユーザーが指定したラベル。
  • __meta_vultr_instance_os: オペレーティングシステムの名前。
  • __meta_vultr_instance_os_id: このインスタンスで使用されているオペレーティングシステムのID。
  • __meta_vultr_instance_region: インスタンスが配置されているリージョンのID。
  • __meta_vultr_instance_plan: プランの一意のID。
  • __meta_vultr_instance_main_ip: メインIPv4アドレス。
  • __meta_vultr_instance_internal_ip: プライベートIPアドレス。
  • __meta_vultr_instance_main_ipv6: メインIPv6アドレス。
  • __meta_vultr_instance_features: インスタンスで使用できる機能の一覧。
  • __meta_vultr_instance_tags: インスタンスに関連付けられているタグの一覧。
  • __meta_vultr_instance_hostname: このインスタンスのホスト名。
  • __meta_vultr_instance_server_status: サーバーのヘルスステータス。
  • __meta_vultr_instance_vcpu_count: vCPUの数。
  • __meta_vultr_instance_ram_mb: RAMの容量(MB)。
  • __meta_vultr_instance_disk_gb: ディスクのサイズ(GB)。
  • __meta_vultr_instance_allowed_bandwidth_gb: 月間の帯域幅クォータ(GB)。
# Authentication information used to authenticate to the API server.
# Note that `basic_auth` and `authorization` options are
# mutually exclusive.
# password and password_file are mutually exclusive.

# Optional HTTP basic authentication information, not currently supported by Vultr.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

# The port to scrape metrics from.
[ port: <int> | default = 80 ]

# The time after which the instances are refreshed.
[ refresh_interval: <duration> | default = 60s ]

<static_config>

static_configを使用すると、ターゲットの一覧とそれらの共通ラベルセットを指定できます。スクレイプ設定で静的ターゲットを指定する標準的な方法です。

# The targets specified by the static config.
targets:
  [ - '<host>' ]

# Labels assigned to all metrics scraped from the targets.
labels:
  [ <labelname>: <labelvalue> ... ]

<relabel_config>

リラベリングは、スクレイプされる前にターゲットのラベルセットを動的に書き換えるための強力なツールです。スクレイプ設定ごとに複数のリラベリングステップを設定できます。それらは、設定ファイルでの出現順に各ターゲットのラベルセットに適用されます。

最初に、設定されたターゲットごとのラベルに加えて、ターゲットのjobラベルは、それぞれのスクレイピング設定のjob_name値に設定されます。__address__ラベルは、ターゲットの<host>:<port>アドレスに設定されます。リラベリング後、リラベリング中に設定されていなければ、instanceラベルはデフォルトで__address__の値に設定されます。__scheme____metrics_path__ラベルは、それぞれターゲットのスキームとメトリクスパスに設定されます。__param_<name>ラベルは、<name>と呼ばれる最初に渡されたURLパラメータの値に設定されます。

__scrape_interval____scrape_timeout__ラベルは、ターゲットのインターバルとタイムアウトに設定されます。

__meta_で始まる追加のラベルは、リラベリングフェーズ中に使用できる場合があります。これらは、ターゲットを提供したサービス検出メカニズムによって設定され、メカニズムによって異なります。

__で始まるラベルは、ターゲットのリラベリングが完了した後、ラベルセットから削除されます。

リラベリングステップでラベル値を一時的に保存する必要がある場合(後続のリラベリングステップへの入力として)、__tmpラベル名プレフィックスを使用します。このプレフィックスは、Prometheus自体によって使用されることが保証されていません。

# The source labels select values from existing labels. Their content is concatenated
# using the configured separator and matched against the configured regular expression
# for the replace, keep, and drop actions.
[ source_labels: '[' <labelname> [, ...] ']' ]

# Separator placed between concatenated source label values.
[ separator: <string> | default = ; ]

# Label to which the resulting value is written in a replace action.
# It is mandatory for replace actions. Regex capture groups are available.
[ target_label: <labelname> ]

# Regular expression against which the extracted value is matched.
[ regex: <regex> | default = (.*) ]

# Modulus to take of the hash of the source label values.
[ modulus: <int> ]

# Replacement value against which a regex replace is performed if the
# regular expression matches. Regex capture groups are available.
[ replacement: <string> | default = $1 ]

# Action to perform based on regex matching.
[ action: <relabel_action> | default = replace ]

<regex>は、有効なRE2正規表現です。replacekeepdroplabelmaplabeldroplabelkeepアクションには必須です。正規表現は両端でアンカーされます。正規表現のアンカーを外すには、.*<regex>.*を使用します。

<relabel_action>は、実行するリラベリングアクションを決定します。

  • replace:連結されたsource_labelsに対してregexを照合します。次に、replacementにマッチグループ参照(${1}${2}、…)を値で置き換えて、target_labelreplacementに設定します。regexが一致しない場合、置換は行われません。
  • lowercase:連結されたsource_labelsを小文字に変換します。
  • uppercase:連結されたsource_labelsを大文字に変換します。
  • keep:連結されたsource_labelsregexが一致しないターゲットを削除します。
  • drop:連結されたsource_labelsregexが一致するターゲットを削除します。
  • keepequal:連結されたsource_labelstarget_labelと一致しないターゲットを削除します。
  • dropequal:連結されたsource_labelstarget_labelと一致するターゲットを削除します。
  • hashmod:連結されたsource_labelsのハッシュのmodulustarget_labelに設定します。
  • labelmap:source_labelsに指定されたものだけでなく、すべてのソースラベル名に対してregexを照合します。次に、replacementにマッチグループ参照(${1}${2}、…)を値で置き換えて、一致するラベルの値をreplacementで指定されたラベル名にコピーします。
  • labeldrop:すべてのラベル名に対してregexを照合します。一致するラベルは、ラベルセットから削除されます。
  • labelkeep:すべてのラベル名に対してregexを照合します。一致しないラベルは、ラベルセットから削除されます。

ラベルが削除された後もメトリクスが一意にラベル付けされるように、labeldroplabelkeepには注意が必要です。

<metric_relabel_configs>

メトリクスのリラベリングは、取り込み前の最後のステップとしてサンプルに適用されます。ターゲットのリラベリングと同じ設定形式とアクションを使用します。メトリクスのリラベリングは、upなどの自動生成されたタイムシリーズには適用されません。

これの1つの用途は、取り込みコストが高すぎる時系列を除外することです。

<alert_relabel_configs>

アラートのリラベリングは、アラートがAlertmanagerに送信される前にアラートに適用されます。ターゲットのリラベリングと同じ設定形式とアクションを使用します。アラートのリラベリングは、外部ラベルの後に適用されます。

これの1つの用途は、異なる外部ラベルを持つHAペアのプロメテウスサーバーが同一のアラートを送信することを保証することです。

<alertmanager_config>

alertmanager_configセクションは、Prometheusサーバーがアラートを送信するAlertmanagerインスタンスを指定します。また、これらのAlertmanagerとの通信方法を設定するためのパラメータも提供します。

Alertmanagerは、static_configsパラメータを使用して静的に設定するか、サポートされているサービス検出メカニズムのいずれかを使用して動的に検出できます。

さらに、relabel_configsを使用すると、検出されたエンティティからAlertmanagerを選択し、__alerts_path__ラベルを介して公開される使用されるAPIパスの高度な変更を行うことができます。

# Per-target Alertmanager timeout when pushing alerts.
[ timeout: <duration> | default = 10s ]

# The api version of Alertmanager.
[ api_version: <string> | default = v2 ]

# Prefix for the HTTP path alerts are pushed to.
[ path_prefix: <path> | default = / ]

# Configures the protocol scheme used for requests.
[ scheme: <scheme> | default = http ]

# Sets the `Authorization` header on every request with the
# configured username and password.
# password and password_file are mutually exclusive.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optionally configures AWS's Signature Verification 4 signing process to
# sign requests. Cannot be set at the same time as basic_auth, authorization, or oauth2.
# To use the default credentials from the AWS SDK, use `sigv4: {}`.
sigv4:
  # The AWS region. If blank, the region from the default credentials chain
  # is used.
  [ region: <string> ]

  # The AWS API keys. If blank, the environment variables `AWS_ACCESS_KEY_ID`
  # and `AWS_SECRET_ACCESS_KEY` are used.
  [ access_key: <string> ]
  [ secret_key: <secret> ]

  # Named AWS profile used to authenticate.
  [ profile: <string> ]

  # AWS Role ARN, an alternative to using AWS API keys.
  [ role_arn: <string> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Configures the scrape request's TLS settings.
tls_config:
  [ <tls_config> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# List of Azure service discovery configurations.
azure_sd_configs:
  [ - <azure_sd_config> ... ]

# List of Consul service discovery configurations.
consul_sd_configs:
  [ - <consul_sd_config> ... ]

# List of DNS service discovery configurations.
dns_sd_configs:
  [ - <dns_sd_config> ... ]

# List of EC2 service discovery configurations.
ec2_sd_configs:
  [ - <ec2_sd_config> ... ]

# List of Eureka service discovery configurations.
eureka_sd_configs:
  [ - <eureka_sd_config> ... ]

# List of file service discovery configurations.
file_sd_configs:
  [ - <file_sd_config> ... ]

# List of DigitalOcean service discovery configurations.
digitalocean_sd_configs:
  [ - <digitalocean_sd_config> ... ]

# List of Docker service discovery configurations.
docker_sd_configs:
  [ - <docker_sd_config> ... ]

# List of Docker Swarm service discovery configurations.
dockerswarm_sd_configs:
  [ - <dockerswarm_sd_config> ... ]

# List of GCE service discovery configurations.
gce_sd_configs:
  [ - <gce_sd_config> ... ]

# List of Hetzner service discovery configurations.
hetzner_sd_configs:
  [ - <hetzner_sd_config> ... ]

# List of HTTP service discovery configurations.
http_sd_configs:
  [ - <http_sd_config> ... ]

 # List of IONOS service discovery configurations.
ionos_sd_configs:
  [ - <ionos_sd_config> ... ]

# List of Kubernetes service discovery configurations.
kubernetes_sd_configs:
  [ - <kubernetes_sd_config> ... ]

# List of Lightsail service discovery configurations.
lightsail_sd_configs:
  [ - <lightsail_sd_config> ... ]

# List of Linode service discovery configurations.
linode_sd_configs:
  [ - <linode_sd_config> ... ]

# List of Marathon service discovery configurations.
marathon_sd_configs:
  [ - <marathon_sd_config> ... ]

# List of AirBnB's Nerve service discovery configurations.
nerve_sd_configs:
  [ - <nerve_sd_config> ... ]

# List of Nomad service discovery configurations.
nomad_sd_configs:
  [ - <nomad_sd_config> ... ]

# List of OpenStack service discovery configurations.
openstack_sd_configs:
  [ - <openstack_sd_config> ... ]

# List of OVHcloud service discovery configurations.
ovhcloud_sd_configs:
  [ - <ovhcloud_sd_config> ... ]

# List of PuppetDB service discovery configurations.
puppetdb_sd_configs:
  [ - <puppetdb_sd_config> ... ]

# List of Scaleway service discovery configurations.
scaleway_sd_configs:
  [ - <scaleway_sd_config> ... ]

# List of Zookeeper Serverset service discovery configurations.
serverset_sd_configs:
  [ - <serverset_sd_config> ... ]

# List of Triton service discovery configurations.
triton_sd_configs:
  [ - <triton_sd_config> ... ]

# List of Uyuni service discovery configurations.
uyuni_sd_configs:
  [ - <uyuni_sd_config> ... ]

# List of Vultr service discovery configurations.
vultr_sd_configs:
  [ - <vultr_sd_config> ... ]

# List of labeled statically configured Alertmanagers.
static_configs:
  [ - <static_config> ... ]

# List of Alertmanager relabel configurations.
relabel_configs:
  [ - <relabel_config> ... ]

# List of alert relabel configurations.
alert_relabel_configs:
  [ - <relabel_config> ... ]

<remote_write>

write_relabel_configsは、サンプルをリモートエンドポイントに送信する前に適用されるリラベリングです。書き込みのリラベリングは、外部ラベルの後に適用されます。これを使用して、送信するサンプルを制限できます。

この機能の使用方法については、小さなデモがあります。

# The URL of the endpoint to send samples to.
url: <string>

# protobuf message to use when writing to the remote write endpoint.
#
# * The `prometheus.WriteRequest` represents the message introduced in Remote Write 1.0, which
# will be deprecated eventually.
# * The `io.prometheus.write.v2.Request` was introduced in Remote Write 2.0 and replaces the former,
# by improving efficiency and sending metadata, created timestamp and native histograms by default.
#
# Before changing this value, consult with your remote storage provider (or test) what message it supports.
# Read more on https://prometheus.dokyumento.jp/docs/specs/remote_write_spec_2_0/#io-prometheus-write-v2-request
[ protobuf_message: <prometheus.WriteRequest | io.prometheus.write.v2.Request> | default = prometheus.WriteRequest ]

# Timeout for requests to the remote write endpoint.
[ remote_timeout: <duration> | default = 30s ]

# Custom HTTP headers to be sent along with each remote write request.
# Be aware that headers that are set by Prometheus itself can't be overwritten.
headers:
  [ <string>: <string> ... ]

# List of remote write relabel configurations.
write_relabel_configs:
  [ - <relabel_config> ... ]

# Name of the remote write config, which if specified must be unique among remote write configs.
# The name will be used in metrics and logging in place of a generated value to help users distinguish between
# remote write configs.
[ name: <string> ]

# Enables sending of exemplars over remote write. Note that exemplar storage itself must be enabled for exemplars to be scraped in the first place.
[ send_exemplars: <boolean> | default = false ]

# Enables sending of native histograms, also known as sparse histograms, over remote write.
# For the `io.prometheus.write.v2.Request` message, this option is noop (always true).
[ send_native_histograms: <boolean> | default = false ]

# Sets the `Authorization` header on every remote write request with the
# configured username and password.
# password and password_file are mutually exclusive.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default = Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optionally configures AWS's Signature Verification 4 signing process to
# sign requests. Cannot be set at the same time as basic_auth, authorization, oauth2, or azuread.
# To use the default credentials from the AWS SDK, use `sigv4: {}`.
sigv4:
  # The AWS region. If blank, the region from the default credentials chain
  # is used.
  [ region: <string> ]

  # The AWS API keys. If blank, the environment variables `AWS_ACCESS_KEY_ID`
  # and `AWS_SECRET_ACCESS_KEY` are used.
  [ access_key: <string> ]
  [ secret_key: <secret> ]

  # Named AWS profile used to authenticate.
  [ profile: <string> ]

  # AWS Role ARN, an alternative to using AWS API keys.
  [ role_arn: <string> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth, authorization, sigv4, or azuread.
oauth2:
  [ <oauth2> ]

# Optional AzureAD configuration.
# Cannot be used at the same time as basic_auth, authorization, oauth2, or sigv4.
azuread:
  # The Azure Cloud. Options are 'AzurePublic', 'AzureChina', or 'AzureGovernment'.
  [ cloud: <string> | default = AzurePublic ]

  # Azure User-assigned Managed identity.
  [ managed_identity:
      [ client_id: <string> ] ]  

  # Azure OAuth.
  [ oauth:
      [ client_id: <string> ]
      [ client_secret: <string> ]
      [ tenant_id: <string> ] ]

  # Azure SDK auth.
  # See https://learn.microsoft.com/en-us/azure/developer/go/azure-sdk-authentication
  [ sdk:
      [ tenant_id: <string> ] ]

# Configures the remote write request's TLS settings.
tls_config:
  [ <tls_config> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default = false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default = true ]

# Configures the queue used to write to remote storage.
queue_config:
  # Number of samples to buffer per shard before we block reading of more
  # samples from the WAL. It is recommended to have enough capacity in each
  # shard to buffer several requests to keep throughput up while processing
  # occasional slow remote requests.
  [ capacity: <int> | default = 10000 ]
  # Maximum number of shards, i.e. amount of concurrency.
  [ max_shards: <int> | default = 50 ]
  # Minimum number of shards, i.e. amount of concurrency.
  [ min_shards: <int> | default = 1 ]
  # Maximum number of samples per send.
  [ max_samples_per_send: <int> | default = 2000]
  # Maximum time a sample will wait for a send. The sample might wait less
  # if the buffer is full. Further time might pass due to potential retries.
  [ batch_send_deadline: <duration> | default = 5s ]
  # Initial retry delay. Gets doubled for every retry.
  [ min_backoff: <duration> | default = 30ms ]
  # Maximum retry delay.
  [ max_backoff: <duration> | default = 5s ]
  # Retry upon receiving a 429 status code from the remote-write storage.
  # This is experimental and might change in the future.
  [ retry_on_http_429: <boolean> | default = false ]
  # If set, any sample that is older than sample_age_limit
  # will not be sent to the remote storage. The default value is 0s,
  # which means that all samples are sent.
  [ sample_age_limit: <duration> | default = 0s ]

# Configures the sending of series metadata to remote storage
# if the `prometheus.WriteRequest` message was chosen. When
# `io.prometheus.write.v2.Request` is used, metadata is always sent.
#
# Metadata configuration is subject to change at any point
# or be removed in future releases.
metadata_config:
  # Whether metric metadata is sent to remote storage or not.
  [ send: <boolean> | default = true ]
  # How frequently metric metadata is sent to remote storage.
  [ send_interval: <duration> | default = 1m ]
  # Maximum number of samples per send.
  [ max_samples_per_send: <int> | default = 500]

この機能との統合のリストはこちらにあります。

<remote_read>

# The URL of the endpoint to query from.
url: <string>

# Name of the remote read config, which if specified must be unique among remote read configs.
# The name will be used in metrics and logging in place of a generated value to help users distinguish between
# remote read configs.
[ name: <string> ]

# An optional list of equality matchers which have to be
# present in a selector to query the remote read endpoint.
required_matchers:
  [ <labelname>: <labelvalue> ... ]

# Timeout for requests to the remote read endpoint.
[ remote_timeout: <duration> | default = 1m ]

# Custom HTTP headers to be sent along with each remote read request.
# Be aware that headers that are set by Prometheus itself can't be overwritten.
headers:
  [ <string>: <string> ... ]

# Whether reads should be made for queries for time ranges that
# the local storage should have complete data for.
[ read_recent: <boolean> | default = false ]

# Sets the `Authorization` header on every remote read request with the
# configured username and password.
# password and password_file are mutually exclusive.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Optional `Authorization` header configuration.
authorization:
  # Sets the authentication type.
  [ type: <string> | default: Bearer ]
  # Sets the credentials. It is mutually exclusive with
  # `credentials_file`.
  [ credentials: <secret> ]
  # Sets the credentials to the credentials read from the configured file.
  # It is mutually exclusive with `credentials`.
  [ credentials_file: <filename> ]

# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth or authorization.
oauth2:
  [ <oauth2> ]

# Configures the remote read request's TLS settings.
tls_config:
  [ <tls_config> ]

# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
[ proxy_from_environment: <boolean> | default: false ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
  [ <string>: [<secret>, ...] ] ]

# Configure whether HTTP requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]

# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]

# Whether to use the external labels as selectors for the remote read endpoint.
[ filter_external_labels: <boolean> | default = true ]

この機能との統合のリストはこちらにあります。

<tsdb>

tsdbを使用すると、TSDBの実行時再ロード可能な設定を設定できます。

注記: 順序外取り込みは実験的な機能ですが、有効にするための追加フラグは必要ありません。out_of_order_time_windowを正の期間に設定すると有効になります。
# Configures how old an out-of-order/out-of-bounds sample can be w.r.t. the TSDB max time.
# An out-of-order/out-of-bounds sample is ingested into the TSDB as long as the timestamp
# of the sample is >= TSDB.MaxTime-out_of_order_time_window.
#
# When out_of_order_time_window is >0, the errors out-of-order and out-of-bounds are
# combined into a single error called 'too-old'; a sample is either (a) ingestible
# into the TSDB, i.e. it is an in-order sample or an out-of-order/out-of-bounds sample
# that is within the out-of-order window, or (b) too-old, i.e. not in-order
# and before the out-of-order window.
#
# When out_of_order_time_window is greater than 0, it also affects experimental agent. It allows 
# the agent's WAL to accept out-of-order samples that fall within the specified time window relative 
# to the timestamp of the last appended sample for the same series.
[ out_of_order_time_window: <duration> | default = 0s ]

<exemplars>

exemplarストレージはまだ実験的であると見なされており、--enable-feature=exemplar-storageを介して有効にする必要があります。

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

<tracing_config>

tracing_configは、OTLPプロトコルを介してPrometheusからトレースバックエンドにトレースをエクスポートするように設定します。トレースは現在実験的な機能であり、将来変更される可能性があります。

# Client used to export the traces. Options are 'http' or 'grpc'.
[ client_type: <string> | default = grpc ]

# Endpoint to send the traces to. Should be provided in format <host>:<port>.
[ endpoint: <string> ]

# Sets the probability a given trace will be sampled. Must be a float from 0 through 1.
[ sampling_fraction: <float> | default = 0 ]

# If disabled, the client will use a secure connection.
[ insecure: <boolean> | default = false ]

# Key-value pairs to be used as headers associated with gRPC or HTTP requests.
headers:
  [ <string>: <string> ... ]

# Compression key for supported compression types. Supported compression: gzip.
[ compression: <string> ]

# Maximum time the exporter will wait for each batch export.
[ timeout: <duration> | default = 10s ]

# TLS configuration.
tls_config:
  [ <tls_config> ]

このドキュメントはオープンソースです。問題やプルリクエストを提出して、改善にご協力ください。