設定
Prometheusはコマンドラインフラグと設定ファイルによって設定されます。コマンドラインフラグは不変のシステムパラメータ(ストレージの場所、ディスクとメモリに保持するデータ量など)を設定しますが、設定ファイルはスクレイピングジョブとそのインスタンス、および読み込むルールファイルに関連するすべてを定義します。
利用可能なすべてのコマンドラインフラグを表示するには、./prometheus -h
を実行します。
Prometheusは実行時に設定をリロードできます。新しい設定が正しくない場合、変更は適用されません。設定のリロードは、PrometheusプロセスにSIGHUP
を送信するか、/-/reload
エンドポイントにHTTP POSTリクエストを送信することによってトリガーされます(--web.enable-lifecycle
フラグが有効な場合)。これにより、設定されたルールファイルもリロードされます。
設定ファイル
読み込む設定ファイルを指定するには、--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)
に一致する期間。例:1d
、1h30m
、5m
、10s
<filename>
: 現在の作業ディレクトリ内の有効なパス<float>
: 浮動小数点数<host>
: ホスト名またはIP、その後にオプションのポート番号が続く有効な文字列<int>
: 整数値<labelname>
: 正規表現[a-zA-Z_][a-zA-Z0-9_]*
に一致する文字列。ソースラベル内の他のサポートされていない文字はアンダースコアに変換する必要があります。例えば、ラベルapp.kubernetes.io/name
はapp_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.
# It cannot be greater than the scrape interval.
[ 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).
# Environment variable references `${var}` or `$var` are replaced according
# to the values of the current environment variables.
# References to undefined variables are replaced by the empty string.
# The `$` character can be escaped by using `$$`.
external_labels:
[ <labelname>: <labelvalue> ... ]
# File to which PromQL queries are logged.
# Reloading the configuration will reopen the file.
[ query_log_file: <string> ]
# File to which scrape failures are logged.
# Reloading the configuration will reopen the file.
[ scrape_failure_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 the 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 ]
# Limit on the number of labels that will be accepted per sample. If more
# than this number of labels are present on any sample post metric-relabeling,
# the entire scrape will be treated as failed. 0 means no limit.
[ label_limit: <int> | default = 0 ]
# Limit on the length (in bytes) of each individual label name. If any label
# name in a scrape is longer than this number post metric-relabeling, the
# entire scrape will be treated as failed. Note that label names are UTF-8
# encoded, and characters can take up to 4 bytes. 0 means no limit.
[ label_name_length_limit: <int> | default = 0 ]
# Limit on the length (in bytes) of each individual label value. If any label
# value in a scrape is longer than this number post metric-relabeling, the
# entire scrape will be treated as failed. Note that label values are UTF-8
# encoded, and characters can take up to 4 bytes. 0 means no limit.
[ label_value_length_limit: <int> | default = 0 ]
# Limit per scrape config 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 ]
# Specifies the validation scheme for metric and label names. Either blank or
# "utf8" for full UTF-8 support, or "legacy" for letters, numbers, colons,
# and underscores.
[ metric_name_validation_scheme: <string> | default "utf8" ]
# Specifies whether to convert all scraped classic histograms into native
# histograms with custom buckets.
[ convert_classic_histograms_to_nhcb: <bool> | default = false]
# Specifies whether to scrape a classic histogram, even if it is also exposed as a native
# histogram (has no effect without --enable-feature=native-histograms).
[ always_scrape_classic_histograms: <boolean> | default = false ]
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 OTLP receiver feature.
# See https://prometheus.dokyumento.jp/docs/guides/opentelemetry/ for best practices.
otlp:
# Promote specific list of resource attributes to labels.
# It cannot be configured simultaneously with 'promote_all_resource_attributes: true'.
[ promote_resource_attributes: [<string>, ...] | default = [ ] ]
# Promoting all resource attributes to labels, except for the ones configured with 'ignore_resource_attributes'.
# Be aware that changes in attributes received by the OTLP endpoint may result in time series churn and lead to high memory usage by the Prometheus server.
# It cannot be set to 'true' simultaneously with 'promote_resource_attributes'.
[ promote_all_resource_attributes: <boolean> | default = false ]
# Which resource attributes to ignore, can only be set when 'promote_all_resource_attributes' is true.
[ ignore_resource_attributes: [<string>, ...] | default = [] ]
# Configures translation of OTLP metrics when received through the OTLP metrics
# endpoint. Available values:
# - "UnderscoreEscapingWithSuffixes" refers to commonly agreed normalization used
# by OpenTelemetry in https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/translator/prometheus
# - "NoUTF8EscapingWithSuffixes" is a mode that relies on UTF-8 support in Prometheus.
# It preserves all special characters like dots, but still adds required metric name suffixes
# for units and _total, as UnderscoreEscapingWithSuffixes does.
# - (EXPERIMENTAL) "NoTranslation" is a mode that relies on UTF-8 support in Prometheus.
# It preserves all special character like dots and won't append special suffixes for metric
# unit and type.
#
# WARNING: The "NoTranslation" setting has significant known risks and limitations (see https://prometheus.dokyumento.jp/docs/practices/naming/
# for details):
# * Impaired UX when using PromQL in plain YAML (e.g. alerts, rules, dashboard, autoscaling configuration).
# * Series collisions which in the best case may result in OOO errors, in the worst case a silently malformed
# time series. For instance, you may end up in situation of ingesting `foo.bar` series with unit
# `seconds` and a separate series `foo.bar` with unit `milliseconds`.
[ translation_strategy: <string> | default = "UnderscoreEscapingWithSuffixes" ]
# Enables adding "service.name", "service.namespace" and "service.instance.id"
# resource attributes to the "target_info" metric, on top of converting
# them into the "instance" and "job" labels.
[ keep_identifying_resource_attributes: <boolean> | default = false ]
# Configures optional translation of OTLP explicit bucket histograms into native histograms with custom buckets.
[ convert_histograms_to_nhcb: <boolean> | default = false ]
# 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.
# It cannot be greater than the scrape interval.
[ 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, PrometheusText1.0.0.
[ scrape_protocols: [<string>, ...] | default = <global_config.scrape_protocols> ]
# Fallback protocol to use if a scrape returns blank, unparseable, or otherwise
# invalid Content-Type.
# Supported values (case sensitive): PrometheusProto, OpenMetricsText0.0.1,
# OpenMetricsText1.0.0, PrometheusText0.0.4, PrometheusText1.0.0.
[ fallback_scrape_protocol: <string> ]
# Whether to scrape a classic histogram, even if it is also exposed as a native
# histogram (has no effect without --enable-feature=native-histograms).
[ always_scrape_classic_histograms: <boolean> |
default = <global.always_scrape_classic_hisotgrams> ]
# 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 ]
# File to which scrape failures are logged.
# Reloading the configuration will reopen the file.
[ scrape_failure_log_file: <string> ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
# 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 STACKIT service discovery configurations.
stackit_sd_configs:
[ - <stackit_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 the 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 ]
# Limit on the number of labels that will be accepted per sample. If more
# than this number of labels are present on any sample post metric-relabeling,
# the entire scrape will be treated as failed. 0 means no limit.
[ label_limit: <int> | default = 0 ]
# Limit on the length (in bytes) of each individual label name. If any label
# name in a scrape is longer than this number post metric-relabeling, the
# entire scrape will be treated as failed. Note that label names are UTF-8
# encoded, and characters can take up to 4 bytes. 0 means no limit.
[ label_name_length_limit: <int> | default = 0 ]
# Limit on the length (in bytes) of each individual label value. If any label
# value in a scrape is longer than this number post metric-relabeling, the
# entire scrape will be treated as failed. Note that label values are UTF-8
# encoded, and characters can take up to 4 bytes. 0 means no limit.
[ label_value_length_limit: <int> | default = 0 ]
# Limit per scrape config 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 ]
# Specifies the validation scheme for metric and label names. Either blank or
# "utf8" for full UTF-8 support, or "legacy" for letters, numbers, colons, and
# underscores.
[ metric_name_validation_scheme: <string> | default "utf8" ]
# Specifies the character escaping scheme that will be requested when scraping
# for metric and label names that do not conform to the legacy Prometheus
# character set. Available options are:
# * `allow-utf-8`: Full UTF-8 support, no escaping needed.
# * `underscores`: Escape all legacy-invalid characters to underscores.
# * `dots`: Escapes dots to `_dot_`, underscores to `__`, and all other
# legacy-invalid characters to underscores.
# * `values`: Prepend the name with `U__` and replace all invalid
# characters with their unicode value, surrounded by underscores. Single
# underscores are replaced with double underscores.
# e.g. "U__my_2e_dotted_2e_name".
# If this value is left blank, Prometheus will default to `allow-utf-8` if the
# validation scheme for the current scrape config is set to utf8, or
# `underscores` if the validation scheme is set to `legacy`.
[ metric_name_escaping_scheme: <string> | default "allow-utf-8" ]
# 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 ]
# Specifies whether to convert classic histograms into native histograms with
# custom buckets (has no effect without --enable-feature=native-histograms).
[ convert_classic_histograms_to_nhcb: <bool> | default =
<global.convert_classic_histograms_to_nhcb>]
ここで、<job_name>
はすべてのスクレイプ設定で一意でなければなりません。
<http_config>
http_config
はHTTPリクエストの設定を可能にします。
# Sets the `Authorization` header on every request with the
# configured username and password.
# username and username_file are mutually exclusive.
# password and password_file are mutually exclusive.
basic_auth:
[ username: <string> ]
[ username_file: <string> ]
[ password: <secret> ]
[ password_file: <string> ]
# Sets the `Authorization` header on every 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 requests follow HTTP 3xx redirects.
[ follow_redirects: <boolean> | default = true ]
# Whether to enable HTTP2.
[ enable_http2: <boolean> | default: true ]
# Configures the 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>, ...] ] ]
# Custom HTTP headers to be sent along with each request.
# Headers that are set by Prometheus itself can't be overwritten.
http_headers:
# Header name.
[ <string>:
# Header values.
[ values: [<string>, ...] ]
# Headers values. Hidden in configuration page.
[ secrets: [<secret>, ...] ]
# Files to read header values from.
[ files: [<string>, ...] ] ]
<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.
# To set 'password' grant type, add it to params:
# endpoint_params:
# grant_type: 'password'
# username: '[email protected]'
# password: 'strongpassword'
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>, ...] ] ]
# Custom HTTP headers to be sent along with each request.
# Headers that are set by Prometheus itself can't be overwritten.
http_headers:
# Header name.
[ <string>:
# Header values.
[ values: [<string>, ...] ]
# Headers values. Hidden in configuration page.
[ secrets: [<secret>, ...] ]
# Files to read header values from.
[ files: [<string>, ...] ] ]
<azure_sd_config>
Azure SD設定により、Azure VMからスクレイプターゲットを取得できます。
ディスカバリには、少なくとも以下の権限が必要です
Microsoft.Compute/virtualMachines/read
: VMディスカバリに必要Microsoft.Network/networkInterfaces/read
: VMディスカバリに必要Microsoft.Compute/virtualMachineScaleSets/virtualMachines/read
: スケールセット (VMSS) ディスカバリに必要Microsoft.Compute/virtualMachineScaleSets/virtualMachines/networkInterfaces/read
: スケールセット (VMSS) ディスカバリに必要
以下のメタラベルが、リラベル中にターゲットで利用可能です
__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 ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
<consul_sd_config>
Consul SD設定により、Consulのカタログ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> ]
# A Consul Filter expression used to filter the catalog results
# See https://www.consul.io/api-docs/catalog#list-services to know more
# about the filter expressions that can be used.
[ filter: <string> ]
# The `tags` and `node_meta` fields are deprecated in Consul in favor of `filter`.
# 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. As of Consul 1.14, consider `filter` instead.
[ 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 ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
ターゲットをスクレイピングするために使用されるIPアドレスとポートは<__meta_consul_address>:<__meta_consul_service_port>
として組み立てられます。ただし、一部のConsulセットアップでは、関連するアドレスが__meta_consul_service_address
にあります。これらの場合、リラベル機能を使用して特殊な__address__
ラベルを置き換えることができます。
リラベルフェーズは、任意のラベルに基づいてサービスまたはノードをフィルタリングするための、より推奨される強力な方法です。数千のサービスを持つユーザーにとっては、ノードのフィルタリング(現在、ノードメタデータと単一タグによる)を基本サポートしているConsul APIを直接使用する方が効率的です。
<digitalocean_sd_config>
DigitalOcean SD設定により、DigitalOceanのDroplets APIからスクレイプターゲットを取得できます。このサービスディスカバリは、デフォルトでパブリックIPv4アドレスを使用しますが、Prometheus digitalocean-sd設定ファイルで示されているように、リラベルによって変更できます。
以下のメタラベルが、リラベル中にターゲットで利用可能です
__meta_digitalocean_droplet_id
: ドロップレットのID__meta_digitalocean_droplet_name
: ドロップレットの名前__meta_digitalocean_image
: ドロップレットのイメージのスラッグ__meta_digitalocean_image_name
: ドロップレットのイメージの表示名__meta_digitalocean_private_ipv4
: ドロップレットのプライベートIPv4__meta_digitalocean_public_ipv4
: ドロップレットのパブリックIPv4__meta_digitalocean_public_ipv6
: ドロップレットのパブリックIPv6__meta_digitalocean_region
: ドロップレットのリージョン__meta_digitalocean_size
: ドロップレットのサイズ__meta_digitalocean_status
: ドロップレットのステータス__meta_digitalocean_features
: ドロップレットの機能のコンマ区切りリスト__meta_digitalocean_tags
: ドロップレットのタグのコンマ区切りリスト__meta_digitalocean_vpc
: ドロップレットのVPC ID
# The port to scrape metrics from.
[ port: <int> | default = 80 ]
# The time after which the droplets are refreshed.
[ refresh_interval: <duration> | default = 60s ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
<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>
# 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 ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
リラベルフェーズは、コンテナをフィルタリングするための、より推奨される強力な方法です。数千のコンテナを持つユーザーにとっては、コンテナのフィルタリング(filters
を使用)を基本サポートしているDocker APIを直接使用する方が効率的です。
このPrometheus設定ファイルの例で、Docker EngineのPrometheus設定の詳細な例を確認できます。
<dockerswarm_sd_config>
Docker Swarm SD設定により、Docker Swarmエンジンからスクレイプターゲットを取得できます。
以下のロールのいずれかを設定してターゲットを検出できます
services
services
ロールはすべてのSwarmサービスを検出し、そのポートをターゲットとして公開します。サービスの公開ポートごとに1つのターゲットが生成されます。サービスに公開ポートがない場合、SD設定で定義されたport
パラメータを使用して、サービスごとに1つのターゲットが作成されます。
利用可能なメタラベル
__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タスクを検出し、そのポートをターゲットとして公開します。タスクの公開ポートごとに1つのターゲットが生成されます。タスクに公開ポートがない場合、SD設定で定義されたport
パラメータを使用して、タスクごとに1つのターゲットが作成されます。
利用可能なメタラベル
__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
: ノードのステータス
__meta_dockerswarm_network_*
メタラベルは、mode=host
で公開されたポートには設定されません。
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>
# 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 ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
リラベルフェーズは、タスク、サービス、またはノードをフィルタリングするための、より推奨される強力な方法です。数千のタスクを持つユーザーにとっては、ノードのフィルタリング(filters
を使用)を基本サポートしているSwarm APIを直接使用する方が効率的です。
このPrometheus設定ファイルの例で、Docker Swarmの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マシンイメージ__meta_ec2_architecture
: インスタンスのアーキテクチャ__meta_ec2_availability_zone
: インスタンスが実行されている可用性ゾーン__meta_ec2_availability_zone_id
: インスタンスが実行されている可用性ゾーンID(ec2: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>, [...] ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_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
: テナントを所有するユーザーアカウント。
loadbalancer
loadbalancer
ロールは、PROMETHEUS
リスナーを持つ Octavia ロードバランサーごとに1つのターゲットを検出します。ターゲットアドレスは、デフォルトでロードバランサーの VIP アドレスになります。
以下のメタラベルが、リラベル中にターゲットで利用可能です
__meta_openstack_loadbalancer_availability_zone
: OpenStack ロードバランサーのアベイラビリティゾーン。__meta_openstack_loadbalancer_floating_ip
: OpenStack ロードバランサーのフローティング IP。__meta_openstack_loadbalancer_id
: OpenStack ロードバランサー ID。__meta_openstack_loadbalancer_name
: OpenStack ロードバランサー名。__meta_openstack_loadbalancer_provider
: OpenStack ロードバランサーの Octavia プロバイダー。__meta_openstack_loadbalancer_operating_status
: OpenStack ロードバランサーの動作ステータス。__meta_openstack_loadbalancer_provisioning_status
: OpenStack ロードバランサーのプロビジョニングステータス。__meta_openstack_loadbalancer_tags
: OpenStack ロードバランサーのタグをコンマ区切りでリスト。__meta_openstack_loadbalancer_vip
: OpenStack ロードバランサーの VIP。__meta_openstack_project_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 ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
PuppetDB で Prometheus を構成する詳細な例については、この Prometheus 構成ファイルの例 を参照してください。
<file_sd_config>
ファイルベースのサービスディスカバリは、静的ターゲットを構成するためのより一般的な方法を提供し、カスタムサービスディスカバリメカニズムをプラグインするためのインターフェースとして機能します。
これは、0 個以上の <static_config>
のリストを含む一連のファイルを読み込みます。定義されたすべてのファイルへの変更は、ディスク監視によって検出され、すぐに適用されます。
これらの個々のファイルは変更を監視されますが、親ディレクトリも暗黙的に監視されます。これは、アトミックな名前変更 を効率的に処理し、構成されたグロブに一致する新しいファイルを検出するためです。親ディレクトリに多数の他のファイルが含まれている場合、それらに関連するイベントは関連しないにもかかわらず、これらの各ファイルも監視されるため、問題が発生する可能性があります。
ファイルは 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 のデフォルトクライアントによって、以下の場所を優先順位で検索して検出されます。
GOOGLE_APPLICATION_CREDENTIALS
環境変数で指定された JSON ファイル- 既知のパス
$HOME/.config/gcloud/application_default_credentials.json
にある JSON ファイル - GCE メタデータサーバーから取得
Prometheus が GCE 内で実行されている場合、実行中のインスタンスに関連付けられたサービスアカウントは、Compute リソースに対して少なくとも読み取り専用の権限を持っている必要があります。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
: サーバーのデータセンター
以下のラベルは、role
が hcloud
に設定されたターゲットでのみ利用可能です。
__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_<networkname>
: 指定されたネットワーク内のサーバーのプライベート IPv4 アドレス__meta_hetzner_hcloud_label_<labelname>
: サーバーの各ラベル (サポートされていない文字はアンダースコアに変換)__meta_hetzner_hcloud_labelpresent_<labelname>
: サーバーの各ラベルに対してtrue
(サポートされていない文字はアンダースコアに変換)
以下のラベルは、role
が robot
に設定されたターゲットでのみ利用可能です。
__meta_hetzner_robot_product
: サーバーの製品__meta_hetzner_robot_cancelled
: サーバーのキャンセルステータス
# The Hetzner role of entities that should be discovered.
# One of robot or hcloud.
role: <string>
# The port to scrape metrics from.
[ port: <int> | default = 80 ]
# The time after which the servers are refreshed.
[ refresh_interval: <duration> | default = 60s ]
# Label selector used to filter the servers when fetching them from the API. See https://docs.hetzner.cloud/#label-selector for more details.
# Only used when role is hcloud.
[ label_selector: <string> ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
<http_sd_config>
HTTP ベースのサービスディスカバリは、静的ターゲットを構成するためのより一般的な方法を提供し、カスタムサービスディスカバリメカニズムをプラグインするためのインターフェースとして機能します。
これは、0 個以上の <static_config>
のリストを含む HTTP エンドポイントからターゲットを取得します。ターゲットは HTTP 200 レスポンスで応答する必要があります。HTTP ヘッダー Content-Type
は application/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 ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
<ionos_sd_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_name>
: サーバーに接続されている各 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>
# The port to scrape metrics from.
[ port: <int> | default = 80 ]
# The time after which the servers are refreshed.
[ refresh_interval: <duration> | default = 60s ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
<kubernetes_sd_config>
Kubernetes SD 構成を使用すると、Kubernetes の REST API からスクレイピングターゲットを取得し、常にクラスターの状態と同期を保つことができます。
ターゲットを検出するために、以下の role
タイプのいずれかを構成できます。
node
node
ロールは、クラスターノードごとに1つのターゲットを検出し、アドレスはデフォルトで Kubelet の HTTP ポートになります。ターゲットアドレスは、デフォルトで NodeInternalIP
、NodeExternalIP
、NodeLegacyHostIP
、NodeHostName
のアドレスタイプ順で Kubernetes ノードオブジェクトの最初の既存のアドレスになります。
利用可能なメタラベル
__meta_kubernetes_node_name
: ノードオブジェクトの名前。__meta_kubernetes_node_provider_id
: クラウドプロバイダーがノードオブジェクトに付けた名前。__meta_kubernetes_node_label_<labelname>
: ノードオブジェクトの各ラベル (サポートされていない文字はアンダースコアに変換)。__meta_kubernetes_node_labelpresent_<labelname>
: ノードオブジェクトの各ラベルに対してtrue
(サポートされていない文字はアンダースコアに変換)。__meta_kubernetes_node_annotation_<annotationname>
: ノードオブジェクトの各アノテーション。__meta_kubernetes_node_annotationpresent_<annotationname>
: ノードオブジェクトの各アノテーションに対してtrue
。__meta_kubernetes_node_address_<address_type>
: 各ノードアドレスタイプの最初のアドレス (存在する場合)。
さらに、ノードの instance
ラベルは、API サーバーから取得されたノード名に設定されます。
service
service
ロールは、各サービスポートに対してターゲットを検出します。これは通常、サービスのブラックボックス監視に役立ちます。アドレスは、サービスの Kubernetes DNS 名と対応するサービスポートに設定されます。
利用可能なメタラベル
__meta_kubernetes_namespace
: サービスオブジェクトの名前空間。__meta_kubernetes_service_annotation_<annotationname>
: サービスオブジェクトの各アノテーション。__meta_kubernetes_service_annotationpresent_<annotationname>
: サービスオブジェクトの各アノテーションに対して「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_<labelname>
: サービスオブジェクトの各ラベル (サポートされていない文字はアンダースコアに変換)。__meta_kubernetes_service_labelpresent_<labelname>
: サービスオブジェクトの各ラベルに対して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
ロールはすべての Pod を検出し、そのコンテナをターゲットとして公開します。コンテナの宣言されたポートごとに、1つのターゲットが生成されます。コンテナに指定されたポートがない場合、リラベルによって手動でポートを追加するために、コンテナごとにポートなしのターゲットが作成されます。
利用可能なメタラベル
__meta_kubernetes_namespace
: Pod オブジェクトの名前空間。__meta_kubernetes_pod_name
: Pod オブジェクトの名前。__meta_kubernetes_pod_ip
: Pod オブジェクトの Pod IP。__meta_kubernetes_pod_label_<labelname>
: Pod オブジェクトの各ラベル (サポートされていない文字はアンダースコアに変換)。__meta_kubernetes_pod_labelpresent_<labelname>
: Pod オブジェクトの各ラベルに対してtrue
(サポートされていない文字はアンダースコアに変換)。__meta_kubernetes_pod_annotation_<annotationname>
: Pod オブジェクトの各アノテーション。__meta_kubernetes_pod_annotationpresent_<annotationname>
: Pod オブジェクトの各アノテーションに対してtrue
。__meta_kubernetes_pod_container_init
: コンテナが InitContainer の場合はtrue
。__meta_kubernetes_pod_container_name
: ターゲットアドレスが指すコンテナの名前。__meta_kubernetes_pod_container_id
: ターゲットアドレスが指すコンテナの ID。ID は<type>://<container_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
: Pod の準備状態に応じてtrue
またはfalse
に設定されます。__meta_kubernetes_pod_phase
: ライフサイクル においてPending
、Running
、Succeeded
、Failed
、またはUnknown
に設定されます。__meta_kubernetes_pod_node_name
: Pod がスケジュールされているノードの名前。__meta_kubernetes_pod_host_ip
: Pod オブジェクトの現在のホスト IP。__meta_kubernetes_pod_uid
: Pod オブジェクトの UID。__meta_kubernetes_pod_controller_kind
: Pod コントローラーのオブジェクト種別。__meta_kubernetes_pod_controller_name
: Pod コントローラーの名前。
endpoints
endpoints
ロールは、サービスのリストされたエンドポイントからターゲットを検出します。各エンドポイントアドレスに対して、ポートごとに1つのターゲットが検出されます。エンドポイントが Pod によってバックアップされている場合、エンドポイントポートにバインドされていない Pod の追加のコンテナポートもすべてターゲットとして検出されます。
Endpoints API は Kubernetes v1.33+ では非推奨 であることに注意してください。代わりに EndpointSlices を使用し、以下の endpointslice
ロールに切り替えることをお勧めします。
利用可能なメタラベル
__meta_kubernetes_namespace
: エンドポイントオブジェクトの名前空間。__meta_kubernetes_endpoints_name
: エンドポイントオブジェクトの名前。__meta_kubernetes_endpoints_label_<labelname>
: エンドポイントオブジェクトの各ラベル (サポートされていない文字はアンダースコアに変換)。__meta_kubernetes_endpoints_labelpresent_<labelname>
: エンドポイントオブジェクトの各ラベルに対してtrue
(サポートされていない文字はアンダースコアに変換)。__meta_kubernetes_endpoints_annotation_<annotationname>
: エンドポイントオブジェクトの各アノテーション。__meta_kubernetes_endpoints_annotationpresent_<annotationname>
: エンドポイントオブジェクトの各アノテーションに対してtrue
。- エンドポイントリストから直接検出されたすべてのターゲット (下層の Pod から追加で推論されていないもの) には、以下のラベルがアタッチされます。
__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
ディスカバリのすべてのラベルがアタッチされます。 - Pod によってバックアップされているすべてのターゲットには、
role: pod
ディスカバリのすべてのラベルがアタッチされます。
endpointslice
endpointslice
ロールは、既存の endpointslice からターゲットを検出します。endpointslice オブジェクトで参照されている各エンドポイントアドレスに対して、1つのターゲットが検出されます。エンドポイントが Pod によってバックアップされている場合、エンドポイントポートにバインドされていない Pod の追加のコンテナポートもすべてターゲットとして検出されます。
このロールには discovery.k8s.io/v1
API バージョンが必要です (Kubernetes v1.21 以降で利用可能)。
利用可能なメタラベル
__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 リストから直接検出されたすべてのターゲット (下層の Pod から追加で推論されていないもの) には、以下のラベルがアタッチされます。
__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
: 参照されるエンドポイントが存在するゾーン。__meta_kubernetes_endpointslice_port
: 参照されるエンドポイントのポート。__meta_kubernetes_endpointslice_port_name
: 参照されるエンドポイントの名前付きポート。__meta_kubernetes_endpointslice_port_protocol
: 参照されるエンドポイントのプロトコル。
- エンドポイントがサービスに属している場合、
role: service
ディスカバリのすべてのラベルがアタッチされます。 - Pod によってバックアップされているすべてのターゲットには、
role: pod
ディスカバリのすべてのラベルがアタッチされます。
ingress
ingress
ロールは、各インgress の各パスに対してターゲットを検出します。これは通常、インgress のブラックボックス監視に役立ちます。アドレスは、インgress スペックで指定されたホストに設定されます。
このロールには networking.k8s.io/v1
API バージョンが必要です (Kubernetes v1.19 以降で利用可能)。
利用可能なメタラベル
__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 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 ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
Kubernetes 用の Prometheus を構成する詳細な例については、この Prometheus 構成ファイルの例 を参照してください。
Kubernetes 上の Prometheus セットアップを自動化するサードパーティの Prometheus Operator を確認することをお勧めします。
<kuma_sd_config>
Kuma SD 構成を使用すると、Kuma コントロールプレーンからスクレイピングターゲットを取得できます。
この SD は、Kuma Dataplane Proxies に基づく「監視割り当て」を MADS v1 (Monitoring Assignment Discovery Service) xDS API を介して検出し、Prometheus が有効なメッシュ内の各プロキシに対してターゲットを作成します。
各ターゲットには、以下のメタラベルが利用可能です。
__meta_kuma_mesh
: プロキシのメッシュ名__meta_kuma_dataplane
: プロキシ名__meta_kuma_service
: プロキシに関連付けられたサービス名__meta_kuma_label_<tagname>
: プロキシの各タグ
Kuma MonitoringAssignment ディスカバリの構成オプションについては、以下を参照してください。
# 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 ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
リラベルフェーズは、プロキシとユーザー定義タグをフィルタリングするための推奨される、より強力な方法です。
<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 ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
<linode_sd_config>
Linode SD 構成を使用すると、Linode の Linode APIv4 からスクレイピングターゲットを取得できます。このサービスディスカバリは、デフォルトでパブリック IPv4 アドレスを使用しますが、Prometheus linode-sd 構成ファイル で示されているように、リラベルによって変更できます。
Linode APIv4 トークンは、linodes:read_only
、ips:read_only
、および events:read_only
のスコープで作成する必要があります。
以下のメタラベルが、リラベル中にターゲットで利用可能です
__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
: タグセパレーターで結合されたマスク付き IPv6 範囲のリスト
# Optional region to filter on.
[ region: <string> ]
# 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 ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
<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> ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
デフォルトでは、Marathon にリストされているすべてのアプリが Prometheus によってスクレイピングされます。すべてのサービスが Prometheus メトリックを提供しない場合、Marathon ラベルと Prometheus のリラベルを使用して、実際にスクレイピングされるインスタンスを制御できます。Marathon アプリと Prometheus 構成のセットアップ方法に関する実用的な例については、Prometheus marathon-sd 構成ファイル を参照してください。
デフォルトでは、すべてのアプリは Prometheus で単一のジョブとして表示されます (構成ファイルで指定されたもの)。これはリラベルを使用しても変更できます。
<nerve_sd_config>
Nerve SD 構成を使用すると、[AirBnB の Nerve] からスクレイピングターゲットを取得できます。これは Zookeeper に保存されています。
以下のメタラベルが、リラベル中にターゲットで利用可能です
__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 の Service 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 ]
# The URL to connect to the API.
[ server: <string> ]
[ tag_separator: <string> | default = ,]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
<serverset_sd_config>
Serverset SD 構成を使用すると、[Serversets] からスクレイピングターゲットを取得できます。これは Zookeeper に保存されています。Serversets は通常、Finagle および Aurora で使用されます。
以下のメタラベルが、リラベル中にターゲットで利用可能です
__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 形式は現在サポートされていません。
<stackit_sd_config>
STACKIT SD 構成を使用すると、さまざまな API からスクレイピングターゲットを取得できます。
以下のメタラベルが、リラベル中にターゲットで利用可能です
__meta_stackit_availability_zone
: サーバーのアベイラビリティゾーン。__meta_stackit_label_<labelname>
: 各サーバーラベル (サポートされていない文字はアンダースコアに置き換えられます)。__meta_stackit_labelpresent_<labelname>
: サーバーの各ラベルに対して "true" (サポートされていない文字はアンダースコアに置き換えられます)。__meta_stackit_private_ipv4_<networkname>
: 指定されたネットワーク内のサーバーのプライベート IPv4 アドレス__meta_stackit_public_ipv4
: サーバーのパブリック IPv4 アドレス__meta_stackit_id
: ターゲットの ID。__meta_stackit_type
: ターゲットのタイプまたはブランド。__meta_stackit_name
: サーバー名。__meta_stackit_status
: サーバーの現在のステータス。__meta_stackit_power_status
: サーバーの電源ステータス。
STACKIT ディスカバリの構成オプションについては、以下を参照してください。
# The STACKIT project
project: <string>
# STACKIT region to use. No automatic discovery of the region is done.
[ region : <string> | default = "eu01" ]
# Custom API endpoint to be used. Format scheme://host:port
[ endpoint : <string> ]
# The port to scrape metrics from.
[ port: <int> | default = 80 ]
# Raw private key string used for authenticating a service account
[ private_key: <string> ]
# Path to a file containing the raw private key string
[ private_key_path: <string> ]
# Full JSON-formatted service account key used for authentication
[ service_account_key: <string> ]
# Path to a file containing the JSON-formatted service account key
[ service_account_key_path: <string> ]
# Path to a file containing STACKIT credentials.
[ credentials_file_path: <string> ]
# The time after which the servers are refreshed.
[ refresh_interval: <duration> | default = 60s ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
サービスアカウントトークンは http_config
を介して設定できます。
stackit_sd_config:
- authorization:
credentials: <token>
<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>
# Refresh interval to re-read the app instance list.
[ refresh_interval: <duration> | default = 30s ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
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_public_ipv4_addresses
: サーバーのパブリックIPv4アドレス__meta_scaleway_instance_public_ipv6_addresses
: サーバーのパブリック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 ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_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 ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_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単位)。
# The port to scrape metrics from.
[ port: <int> | default = 80 ]
# The time after which the instances are refreshed.
[ refresh_interval: <duration> | default = 60s ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
<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__
ラベルは、それぞれscrape_config
で指定されたターゲットのスキームとメトリクスパスに設定されます。
__param_<name>
ラベルは、scrape_config
で定義されている、最初に渡された<name>
というURLパラメーターの値に設定されます。
__scrape_interval__
と__scrape_timeout__
ラベルは、scrape_config
で指定されたターゲットのインターバルとタイムアウトに設定されます。
リラベルフェーズ中に、__meta_
で始まる追加のラベルが利用できる場合があります。これらは、ターゲットを提供したサービスディスカバリメカニズムによって設定され、メカニズムによって異なります。
__
で始まるラベルは、ターゲットのリラベルが完了した後、ラベルセットから削除されます。
リラベルステップでラベル値を一時的にのみ保存する必要がある場合(後続のリラベルステップへの入力として)、__tmp
ラベル名プレフィックスを使用します。このプレフィックスはPrometheus自身が使用しないことが保証されています。
# The source_labels tells the rule what labels to fetch from the series. Any
# labels which do not exist get a blank value (""). 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正規表現です。replace
、keep
、drop
、labelmap
、labeldrop
、およびlabelkeep
アクションには必須です。正規表現は両端で固定されます。正規表現の固定を解除するには、.*<regex>.*
を使用します。
<relabel_action>
は、実行するリラベルアクションを決定します。
replace
: 連結されたsource_labels
に対してregex
を照合します。その後、replacement
に一致するグループ参照 (${1}
、${2}
、...) をその値に置き換えて、target_label
をreplacement
に設定します。regex
が一致しない場合、置き換えは行われません。lowercase
: 連結されたsource_labels
を小文字に変換します。uppercase
: 連結されたsource_labels
を大文字に変換します。keep
:regex
が連結されたsource_labels
に一致しないターゲットを破棄します。drop
:regex
が連結されたsource_labels
に一致するターゲットを破棄します。keepequal
: 連結されたsource_labels
がtarget_label
に一致しないターゲットを破棄します。dropequal
: 連結されたsource_labels
がtarget_label
に一致するターゲットを破棄します。hashmod
: 連結されたsource_labels
のハッシュのmodulus
をtarget_label
に設定します。labelmap
:source_labels
で指定されたものだけでなく、すべてのソースラベル名に対してregex
を照合します。その後、一致するラベルの値を、replacement
内の一致するグループ参照 (${1}
、${2}
、...) をその値に置き換えたreplacement
で指定されたラベル名にコピーします。labeldrop
: すべてのラベル名に対してregex
を照合します。一致するラベルはすべてラベルセットから削除されます。labelkeep
: すべてのラベル名に対してregex
を照合します。一致しないラベルはすべてラベルセットから削除されます。
labeldrop
とlabelkeep
を使用する場合は、ラベルが削除された後もメトリクスが一意にラベル付けされていることを確認するために注意が必要です。
<metric_relabel_configs>
メトリクスのリラベルは、取り込みの最終ステップとしてサンプルに適用されます。ターゲットのリラベルと同じ構成形式とアクションを持ちます。メトリクスのリラベルは、up
などの自動生成された時系列には適用されません。
これを使用する目的の1つは、取り込みコストが高すぎる時系列を除外することです。
<alert_relabel_configs>
アラートのリラベルは、Alertmanagerに送信される前にアラートに適用されます。ターゲットのリラベルと同じ設定形式とアクションを持ちます。アラートのリラベルは外部ラベルの後に適用されます。
これを使用する目的の1つは、異なる外部ラベルを持つPrometheusサーバーのHAペアが同一のアラートを送信することを確認することです。
<alertmanager_config>
alertmanager_config
セクションでは、Prometheusサーバーがアラートを送信するAlertmanagerインスタンスを指定します。また、これらのAlertmanagerと通信する方法を設定するためのパラメータも提供します。
Alertmanagerは、static_configs
パラメータを介して静的に設定することも、サポートされているサービスディスカバリメカニズムのいずれかを使用して動的に検出することもできます。
さらに、relabel_configs
を使用すると、検出されたエンティティからAlertmanagerを選択し、使用されるAPIパス(__alerts_path__
ラベルを介して公開されます)に高度な変更を加えることができます。
# 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 ]
# Optionally configures AWS's Signature Verification 4 signing process to sign requests.
# Cannot be set at the same time as basic_auth, authorization, oauth2, azuread or google_iam.
# 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> ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
# 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 STACKIT service discovery configurations.
stackit_sd_configs:
[ - <stackit_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 ]
# When enabled, remote-write will resolve the URL host name via DNS, choose one of the IP addresses at random, and connect to it.
# When disabled, remote-write relies on Go's standard behavior, which is to try to connect to each address in turn.
# The connection timeout applies to the whole operation, i.e. in the latter case it is spread over all attempt.
# This is an experimental feature, and its behavior might still change, or even get removed.
[ round_robin_dns: <boolean> | default = false ]
# 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 AzureAD configuration.
# Cannot be used at the same time as basic_auth, authorization, oauth2, sigv4 or google_iam.
azuread:
# The Azure Cloud. Options are 'AzurePublic', 'AzureChina', or 'AzureGovernment'.
[ cloud: <string> | default = AzurePublic ]
# Azure Managed Identity. Leave 'client_id' blank to use the default 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> ] ]
# WARNING: Remote write is NOT SUPPORTED by Google Cloud. This configuration is reserved for future use.
# Optional Google Cloud Monitoring configuration.
# Cannot be used at the same time as basic_auth, authorization, oauth2, sigv4 or azuread.
# To use the default credentials from the Google Cloud SDK, use `google_iam: {}`.
google_iam:
# Service account key with monitoring write permissions.
credentials_file: <file_name>
# 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]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
# enable_http2 defaults to false for remote-write.
[ <http_config> ]
この機能を備えたインテグレーションのリストがあります。
<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 ]
# Whether to use the external labels as selectors for the remote read endpoint.
[ filter_external_labels: <boolean> | default = true ]
# HTTP client settings, including authentication methods (such as basic auth and
# authorization), proxy configurations, TLS options, custom HTTP headers, etc.
[ <http_config> ]
この機能を備えたインテグレーションのリストがあります。
<tsdb>
tsdb
では、TSDBのランタイムで再読み込み可能な設定を構成できます。
# 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>
エクゼンプラストレージはまだ実験的なものとみなされており、--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> ]