Caution
Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. Read more about why we recommend migrating to Grafana Alloy.
Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
prometheus.exporter.blackbox
The prometheus.exporter.blackbox
component embeds
blackbox_exporter
. blackbox_exporter
lets you collect blackbox metrics (probes) and expose them as Prometheus metrics.
Usage
prometheus.exporter.blackbox "LABEL" {
config_file = "PATH_BLACKBOX_CONFIG_FILE"
target "TARGET_NAME" {
address = "TARGET_ADDRESS"
}
...
}
Arguments
The following arguments can be used to configure the exporter’s behavior. Omitted fields take their default values.
Name | Type | Description | Default | Required |
---|---|---|---|---|
config_file | string | blackbox_exporter configuration file path. | no | |
config | string | blackbox_exporter configuration as inline string. | no | |
probe_timeout_offset | duration | Offset in seconds to subtract from timeout when probing targets. | "0.5s" | no |
The config_file
argument points to a YAML file defining which blackbox_exporter modules to use.
The config
argument must be a YAML document as string defining which blackbox_exporter modules to use.
config
is typically loaded by using the exports of another component. For example,
local.file.LABEL.content
remote.http.LABEL.content
remote.s3.LABEL.content
See blackbox_exporter for details on how to generate a config file.
Blocks
The following blocks are supported inside the definition of
prometheus.exporter.blackbox
to configure collector-specific options:
Hierarchy | Name | Description | Required |
---|---|---|---|
target | target | Configures a blackbox target. | yes |
target block
The target
block defines an individual blackbox target.
The target
block may be specified multiple times to define multiple targets.
Name | Type | Description | Default | Required |
---|---|---|---|---|
name | string | Name of the target. | yes | |
address | string | The address of the target to probe. | yes | |
module | string | Blackbox module to use to probe. | "" | no |
Exported fields
The following fields are exported and can be referenced by other components.
Name | Type | Description |
---|---|---|
targets | list(map(string)) | The targets that can be used to collect exporter metrics. |
For example, the targets
can either be passed to a discovery.relabel
component to rewrite the targets’ label sets, or to a prometheus.scrape
component that collects the exposed metrics.
The exported targets will use the configured in-memory traffic address specified by the run command.
Component health
prometheus.exporter.blackbox
is only reported as unhealthy if given
an invalid configuration. In those cases, exported fields retain their last
healthy values.
Debug information
prometheus.exporter.blackbox
does not expose any component-specific
debug information.
Debug metrics
prometheus.exporter.blackbox
does not expose any component-specific
debug metrics.
Example
This example uses a prometheus.scrape
component to collect metrics
from prometheus.exporter.blackbox
:
prometheus.exporter.blackbox "example" {
config_file = "blackbox_modules.yml"
target "example" {
address = "http://example.com"
module = "http_2xx"
}
target "grafana" {
address = "http://grafana.com"
module = "http_2xx"
}
}
// Configure a prometheus.scrape component to collect Blackbox metrics.
prometheus.scrape "demo" {
targets = prometheus.exporter.blackbox.example.targets
forward_to = [ /* ... */ ]
}
This example is the same above with using an embedded configuration:
prometheus.exporter.blackbox "example" {
config = "{ modules: { http_2xx: { prober: http, timeout: 5s } } }"
target "example" {
address = "http://example.com"
module = "http_2xx"
}
target "grafana" {
address = "http://grafana.com"
module = "http_2xx"
}
}
// Configure a prometheus.scrape component to collect Blackbox metrics.
prometheus.scrape "demo" {
targets = prometheus.exporter.blackbox.example.targets
forward_to = [ /* ... */ ]
}