Skip to content

Commit

Permalink
Update prometheus.exporter.blackbox.md (#2322)
Browse files Browse the repository at this point in the history
* Update prometheus.exporter.blackbox.md

Added an example of how to configure the `instance` label to work better with some prebuilt dashboards that expect the target url here.

* Update docs/sources/reference/components/prometheus/prometheus.exporter.blackbox.md

---------

Co-authored-by: Clayton Cornell <[email protected]>
(cherry picked from commit 7cb72f6)
  • Loading branch information
maxlemieux authored and grafanabot committed Jan 28, 2025
1 parent 1daffce commit 7be90a1
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,38 @@ Replace the following:
[disc]: ../discovery.file/
[relabel]: ../discovery.relabel/

### Set instance label to target url

Some dashboards may expect the `instance` label on the Blackbox metrics to contain the value of the target URL.
The following example demonstrates how to achieve that with Prometheus relabeling:

```alloy
prometheus.exporter.blackbox "example" {
config = "{ modules: { http_2xx: { prober: http, timeout: 5s } } }"
target {
name = "example"
address = "example.com"
module = "http_2xx"
}
}
discovery.relabel "example" {
targets = prometheus.exporter.blackbox.example.targets
rule {
source_labels = ["__param_target"]
target_label = "instance"
}
}
prometheus.scrape "example" {
targets = discovery.relabel.example.output
forward_to = [prometheus.remote_write.metrics_service.receiver]
}
```

<!-- START GENERATED COMPATIBLE COMPONENTS -->

## Compatible components
Expand Down

0 comments on commit 7be90a1

Please sign in to comment.