我正在配置 blackbox 来监控我的网站。Prometheus 静态配置目标正在工作,但也有点混乱。我想把我所有的目标都归档,但它根本不起作用。
码头工人撰写:
version: '2.1'
volumes:
prometheus_data: {}
services:
prometheus:
mem_limit: 1000m
image: prom/prometheus
container_name: prometheus
volumes:
- ./prometheus/:/etc/prometheus/
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.retention.time=200h'
links:
- 'blackbox:blackbox'
expose:
- 9090
labels:
container_group: monitoring
blackbox:
image: prom/blackbox-exporter
container_name: blackbox
expose:
- 9115
volumes:
- ./blackbox/:/etc/blackbox/
command: --config.file=/etc/blackbox/blackbox.yml
labels:
container_group: monitoring
普罗米修斯.yml
scrape_configs:
- job_name: 'blackbox'
metrics_path: /probe
params:
module: [http_2xx]
file_sd_configs:
- files: ['/blackbox/blackbox_targets.yml']
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- target_label: __address__
replacement: blackbox:9115
blackbox_targets.yml
- targets: ['http://google.com']
labels:
group: 'localhost'
instance: 'localhost'
没有 blackbox_targets.yml 可以看到 prometheus batleter 中的目标丢失。