prometheus: add blackbox exporter

This commit is contained in:
uumas
2023-12-21 01:32:53 +02:00
parent 6f1bcecf25
commit c5a54827d4
5 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
---
modules:
icmp:
prober: icmp
timeout: 5s
icmp:
preferred_ip_protocol: "ip4"

View File

@@ -26,6 +26,35 @@ scrape_configs:
static_configs:
- targets: ["localhost:9090"]
- job_name: "blackbox"
static_configs:
- targets: ["blackbox_exporter:9115"]
{% if prometheus_ping_hosts | length > 0 %}
- job_name: "icmp"
metrics_path: "/probe"
params:
module: ["icmp"]
static_configs:
- targets:
{% for host in prometheus_ping_hosts %}
- "{{ host.name }}::{{ host.type | default('monitored') }}"
{% endfor %}
relabel_configs:
- source_labels: [__address__]
regex: '(.+)::(.+)'
target_label: __param_target
replacement: '${1}'
- source_labels: [__address__]
regex: '(.+)::(.+)'
target_label: host_type
replacement: '${2}'
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox_exporter:9115
{%- endif %}
{% if prometheus_hcloud_enabled %}
- job_name: hcloud
hetzner_sd_configs: