Use alias for blackbox targets in dashboard

This commit is contained in:
nabarun committed 2025-04-07 14:23:14 +05:30
1 parent fb0138e975
commit 159402921d
6 files changed
+50 -21

No files matched your search

@@ -1,7 +1,7 @@
modules:
http_2xx:
prober: http
timeout: 5s
timeout: 15s
http:
valid_status_codes: [] #default to 2xx
method: GET
@@ -136,7 +136,7 @@
"refId": "A"
}
],
"title": "$target status",
"title": "$target",
"type": "row"
},
{
@@ -8,6 +8,7 @@ policies:
group_by:
- grafana_folder
- alertname
- instance
routes:
- receiver: SlackNotifier
object_matchers:
@@ -28,17 +28,25 @@ scrape_configs:
- targets:
# - https://github.com
relabel_configs:
# Forward the original target URL as the 'target' parameter.
- source_labels: [__address__]
regex: (.*)(:80)?
target_label: __param_target
- source_labels: [__param_target]
regex: (.*)
# Use the custom alias if defined for the 'instance' label.
- source_labels: [alias]
target_label: instance
replacement: ${1}
- source_labels: []
regex: .*
target_label: __address__
action: replace
# If no alias is set, fall back to the target URL.
- source_labels: [instance]
regex: ^$
target_label: instance
replacement: ${__param_target}
# Finally, tell Prometheus to scrape the blackbox_exporter.
- target_label: __address__
replacement: blackbox:9115
# Drop the original alias label as it's now redundant with instance
- action: labeldrop
regex: ^alias$
- job_name: chain_heads
scrape_interval: 10s