blackbox_exporter
blackbox_exporter copied to clipboard
Restarting container every time I add a new URL
Host operating system: output of uname -a
Linux orion-master 5.10.63-v7+ #1457 SMP Tue Sep 28 11:25:31 BST 2021 armv7l GNU/Linux
blackbox_exporter version: output of blackbox_exporter --version
latest
What is the blackbox.yml module config.
modules:
http_2xx:
prober: http
timeout: 5s
http:
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
valid_status_codes: []
method: GET
preferred_ip_protocol: "ip4"
ip_protocol_fallback: false
icmp:
prober: icmp
icmp:
preferred_ip_protocol: "ip4"
ip_protocol_fallback: false
What is the prometheus.yml scrape config.
scrape_configs:
- job_name: "website-monitoring-http"
metrics_path: /probe
params:
module: [http_2xx]
file_sd_configs:
- files:
- /etc/prometheus/targets.yml
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
What did you expect to see?
Every time I add a new URL to monitor under /etc/prometheus/targets.yml I am forced to restart the container in order to start gathering those metrics.
Is there anyway to read that config automatically without causing the outage? I am expecting to have more and more URL's added and don't want to force a reboot of the container.
Thank you in advance for the help!
You can use file_sd instead of static_sd. The new url's would be picked automatically.
You can use file_sd instead of static_sd. The new url's would be picked automatically.
Could you please send a sample conf? I thought the file_sd
was already declared with
file_sd_configs:
- files:
- /etc/prometheus/targets.yml
Thanks!
sorry, yes, that is the case. I suspect your file does not make it to the container or is on a filesystem that does not support inotify?
also, are you reloading prometheus? there might be a race if you update and reload at the same time.