dht-prometheus
Version:
Bridge to scrape Prometheus metrics fully peer to peer
38 lines (35 loc) • 1.37 kB
YAML
# This is an example config.
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'dht-prometheus' # The metrics of the dht-prometheus service itself
static_configs:
- targets:
- "localhost:30000" # Replace with the host and port where the dht-prometheus http server runs
- job_name: 'dht-prom-redirects'
file_sd_configs:
- files:
- 'targets.json'
# Source for relabeling approach: https://stackoverflow.com/questions/59866342/prometheus-dynamic-metrics-path
relabel_configs:
relabel_configs:
# Targets are structured as <alias>:<target z32 key>:hostname:service (we extract each part)
- source_labels: [__address__]
regex: "(.+):.{52}:.+"
replacement: "$1"
target_label: instance
- source_labels: [instance]
replacement: "/scrape/$1/metrics"
target_label: __metrics_path__ # => instead of default /metrics
- source_labels: [__address__]
regex: ".+:.{52}:([^:]+):.+"
replacement: "$1"
target_label: hostname
- source_labels: [__address__]
regex: ".+:.{52}:[^:]+:(.+)"
replacement: "$1"
target_label: service
- source_labels: [__address__]
replacement: "localhost:30000" # Replace with the host and port where the dht-prometheus http server runs
target_label: __address__