How to Monitor URLs with Blackbox Exporter
This article was last updated on: May 17, 2026 am
Introduction
Monitoring domains and URLs is an important aspect of observability, primarily used for diagnosing availability issues. This article provides a detailed guide on how to implement URL monitoring in Kubernetes using Blackbox Exporter and Prometheus.
Overview of Blackbox Exporter
Blackbox Exporter is an optional component of Prometheus. Like other exporters, its main purpose is to convert monitoring data into a metrics format that Prometheus can understand, namely the Prometheus exposition format.
Endpoint Monitoring
Endpoint monitoring refers to monitoring various parameters of both internal and external endpoints (HTTP/S, DNS, TCP, ICMP, and gRPC), including HTTP response time, DNS query latency, SSL certificate expiration information, TLS version, and more.
In Kubernetes, it’s not just external endpoints that need monitoring — internal endpoints also need to be monitored for response time and other parameters. These metrics are a critical part of infrastructure to ensure service continuity, availability, and compliance with certain security certifications.
WhiteBox vs. Blackbox Monitoring
WhiteBox monitoring refers to monitoring the internals of a system, including application logging, handlers, tracing, and metrics. In contrast, Blackbox monitoring primarily initiates probes from the outside, probing user-impacting behaviors such as server downtime, non-functioning pages, or degraded website performance.
Blackbox Exporter
Blackbox Exporter is used to probe endpoints such as HTTPS, HTTP, TCP, DNS, ICMP, and gRPC. After you define the endpoints, Blackbox Exporter generates metrics that can be visualized using tools like Grafana. One of the most important features of Blackbox Exporter is measuring endpoint availability.
The following diagram shows the workflow of Blackbox Exporter monitoring an endpoint:

Installing and Configuring Blackbox Exporter
Installing Blackbox Exporter with Helm
Installing Blackbox Exporter is straightforward and can be done via a Helm Chart:
1 | |
🎉
Basic Blackbox Configuration
Below is a default module defined in the Blackbox Exporter configuration:
blackbox.yaml:
1 | |
You can configure your own blackbox.yml accordingly so that the probe returns success/failure based on your configuration. Using the configuration above as an example, here is a detailed explanation of the module and http probe settings:
- prober: The protocol for probing (can be: http, tcp, dns, icmp, grpc).
- timeout: Probe timeout duration.
- http: HTTP probe configuration.
Next are the HTTP probe configuration options:
- valid_status_codes:
, … | default = 2xx: Acceptable status codes for this probe. Defaults to 2xx. Using the default is recommended. - valid_http_versions: HTTP versions accepted by this probe. Options: HTTP/1.1 HTTP/2.0
- method:
| default = “GET”: HTTP method used by the probe. - headers: Headers used by the probe. For example, you can add headers like user-agent to avoid being blocked by a WAF.
- body_size_limit:
| default = 0: Maximum uncompressed body length (in bytes) to be processed. A value of 0 means no limit. - compression: Compression algorithm for decompressing the response (gzip, br, deflate, ident).
- follow_redirects:
| default = true: Whether to follow redirects. - fail_if_ssl: Probe fails if SSL is present.
- fail_if_not_ssl: Probe fails if SSL is not present.
- fail_if_body_matches_regexp: Fails if the returned body matches this regex.
- fail_if_body_not_matches_regexp: Fails if the returned body does not match this regex.
- fail_if_header_matches: Fails if the returned header matches this regex. For headers with multiple values, it fails if at least one matches.
- fail_if_header_not_matches: Fails if the returned header does not match this regex.
- tls_config: TLS protocol configuration for the HTTP probe, commonly used for private certificates.
- basic_auth: HTTP basic auth credentials for the target.
- bearer_token:
: Bearer token for the target. - proxy_url: Configuration for the proxy server used to connect to the target.
- skip_resolve_phase_with_proxy: Skips DNS resolution and URL changes when an HTTP proxy (proxy_url) is set.
- oauth2: OAuth 2.0 configuration for connecting to the target.
- enable_http2: Whether to enable HTTP/2.
- preferred_ip_protocol: IP protocol for the HTTP probe (ip4, ip6).
- ip_protocol_fallback
- body: HTTP request body used in the probe.
You can check this example.yml for detailed examples and more information. Additionally, some configuration changes need to be made in Prometheus for Blackbox Exporter to send metrics related to the application’s configuration.
Configuration in Prometheus
You need to configure scrape settings in Prometheus, as well as Blackbox-related Alert Rules.
Prometheus Scrape Configuration for Blackbox
Example:
1 | |
Directly modifying the Prometheus configuration like this is error-prone. If you already have Prometheus Operator installed, you can configure it directly through the Probe CRD, which is much more convenient:
1 | |
Blackbox Exporter Probing Scenarios
When it comes to URLs specifically, Blackbox Exporter covers the following probing scenarios:
- Probing external URLs
- Probing internal Kubernetes Services
- Probing internal Kubernetes Ingresses
- Probing internal Kubernetes Pods
Scenario 1: Probing External URLs
The configuration was already covered above, so it won’t be repeated here.
Scenario 2: Probing Internal Kubernetes Services
In a Kubernetes system, resources and endpoints appear and disappear over time. A very useful type of probing is dynamic probing of resources, including Pods, Services, and Ingresses.
Using Kubernetes service discovery configuration in Prometheus, we can achieve dynamic endpoint probing. Kubernetes service discovery configuration allows fetching scrape targets from the Kubernetes API and staying in sync with the cluster state at all times. You can find the list of available roles that can be configured as discovery targets in the kubernetes_sd_config section of the documentation.
1 | |
Here we can use [__meta_kubernetes_service_annotation_prometheus_io_probe] to only check services that have the prometheus.io/probe = true annotation. Example:
1 | |
Scenario 3: Probing Internal Kubernetes Ingresses
1 | |
Scenario 4: Probing Internal Kubernetes Pods
1 | |
Verifying Generated Metrics in Prometheus

Once the changes are applied and the Blackbox Exporter resources are deployed, we can verify the status of targets in Prometheus. We can check whether Blackbox Exporter has started with the registered targets by navigating to the Status tab and selecting Targets in the Prometheus UI.
Here you can see that we used https://rancher.ewhisper.cn as an external target for reference, and its status is 404. We can also check whether metrics are being collected by looking for metrics prefixed with probe_.

Here you can see a list of some generated probe_ metrics.
| Metric Name | Description |
|---|---|
| probe_duration_seconds | Returns the time (in seconds) for the probe to complete. |
| probe_http_status_code | Response HTTP status code. |
| probe_http_version | Returns the HTTP version of the probe response. |
| probe_success | Indicates whether the probe was successful. |
| probe_dns_lookup_time_seconds | Returns the DNS lookup time for the probe, in seconds. |
| probe_ip_protocol | Specifies whether the probe IP protocol is IP4 or IP6. |
| probe_ssl_earliest_cert_expiry metric | Returns the earliest SSL certificate expiry time in unixtime. |
| probe_tls_version_info | Contains the TLS version in use. |
| probe_failed_due_to_regex | Indicates whether the probe failed due to a regex match. |
| probe_http_content_length | Length of the HTTP content response. |
Monitoring Configured URLs with Grafana
You can directly reuse some dashboards on Grafana to view URL metrics:


Click here 👉 Blackbox Grafana to search and download the corresponding Grafana dashboards.
Summary of Blackbox Advantages
- An open-source, free Blackbox endpoint monitoring tool.
- Supports DNS, TCP, ICMP, and gRPC in addition to HTTP/S.
- Rich HTTP blackbox monitoring configuration options, including headers, authentication, proxies, regex matching, and more.
- Leverages Prometheus + Kubernetes kubernetes_sd_config for dynamic metric generation, enabling dynamic endpoint monitoring.
- Can monitor certificate expiration times.
Industry Use Cases for Blackbox Exporter
Why do you need Blackbox Exporter?
Taking the insurance industry I’m familiar with as an example, medium to large insurance companies typically adopt an organizational structure like:
- Headquarters
- Provincial branches
- Central sub-branches
- Sub-branches
- Sales offices
Branch offices are usually connected to headquarters via dedicated lines and use various insurance business systems provided by headquarters.
While there are various domestic and international tools and services available for monitoring domains and URLs, such as Tingyun, Dynatrace, etc.:
- On one hand, these services charge per probe, and if the probing frequency or number of URLs is high, the cost can be significant.
- On the other hand, these commercial services may not be able to cover the nearly intranet-like network architecture of the insurance industry.
In this scenario, Blackbox Exporter serves as an open-source alternative to existing solutions, maintained by the Prometheus community.
Moreover, Prometheus + Blackbox Exporter + Kubernetes dynamic discovery can significantly reduce the manual effort of configuring large numbers of URL probes.
Additionally, for the scenario described above, you can also use Prometheus + Blackbox Exporter + a lightweight K8s solution like K3s to deploy probe nodes to each branch office, achieving the exact same access path as branch office employees. The network availability between branches and headquarters systems becomes clear at a glance, enabling timely detection of network issues.
Conclusion
In this article, we discussed:
- What Blackbox Exporter is
- How to install and configure it
- Several typical configuration scenarios, especially leveraging Prometheus + Blackbox Exporter + Kubernetes dynamic discovery
- Advantages of Blackbox Exporter
- Industry use cases for Blackbox Exporter
Hope this is helpful to you.
🎉🎉🎉