• Stars
    star
    4,198
  • Rank 9,794 (Top 0.2 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Blackbox prober exporter

Blackbox exporter Build Status

CircleCI Docker Repository on Quay Docker Pulls

The blackbox exporter allows blackbox probing of endpoints over HTTP, HTTPS, DNS, TCP, ICMP and gRPC.

Running this software

From binaries

Download the most suitable binary from the releases tab

Then:

./blackbox_exporter <flags>

Using the docker image

Note: You may want to enable ipv6 in your docker configuration

docker run --rm \
  -p 9115/tcp \
  --name blackbox_exporter \
  -v $(pwd):/config \
  quay.io/prometheus/blackbox-exporter:latest --config.file=/config/blackbox.yml

Checking the results

Visiting http://localhost:9115/probe?target=google.com&module=http_2xx will return metrics for a HTTP probe against google.com. The probe_success metric indicates if the probe succeeded. Adding a debug=true parameter will return debug information for that probe.

TLS and basic authentication

The Blackbox Exporter supports TLS and basic authentication. This enables better control of the various HTTP endpoints.

To use TLS and/or basic authentication, you need to pass a configuration file using the --web.config.file parameter. The format of the file is described in the exporter-toolkit repository.

Note that the TLS and basic authentication settings affect all HTTP endpoints: /metrics for scraping, /probe for probing, and the web UI.

Building the software

Local Build

make

Building with Docker

After a successful local build:

docker build -t blackbox_exporter .

Configuration

Blackbox exporter is configured via a configuration file and command-line flags (such as what configuration file to load, what port to listen on, and the logging format and level).

Blackbox exporter can reload its configuration file at runtime. If the new configuration is not well-formed, the changes will not be applied. A configuration reload is triggered by sending a SIGHUP to the Blackbox exporter process or by sending a HTTP POST request to the /-/reload endpoint.

To view all available command-line flags, run ./blackbox_exporter -h.

To specify which configuration file to load, use the --config.file flag.

Additionally, an example configuration is also available.

HTTP, HTTPS (via the http prober), DNS, TCP socket, ICMP and gRPC (see permissions section) are currently supported. Additional modules can be defined to meet your needs.

The timeout of each probe is automatically determined from the scrape_timeout in the Prometheus config, slightly reduced to allow for network delays. This can be further limited by the timeout in the Blackbox exporter config file. If neither is specified, it defaults to 120 seconds.

Prometheus Configuration

Blackbox exporter implements the multi-target exporter pattern, so we advice to read the guide Understanding and using the multi-target exporter pattern to get the general idea about the configuration.

The blackbox exporter needs to be passed the target as a parameter, this can be done with relabelling.

Example config:

scrape_configs:
  - job_name: 'blackbox'
    metrics_path: /probe
    params:
      module: [http_2xx]  # Look for a HTTP 200 response.
    static_configs:
      - targets:
        - http://prometheus.io    # Target to probe with http.
        - https://prometheus.io   # Target to probe with https.
        - http://example.com:8080 # Target to probe with http on port 8080.
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9115  # The blackbox exporter's real hostname:port.

HTTP probes can accept an additional hostname parameter that will set Host header and TLS SNI. This can be especially useful with dns_sd_config:

scrape_configs:
  - job_name: blackbox_all
    metrics_path: /probe
    params:
      module: [ http_2xx ]  # Look for a HTTP 200 response.
    dns_sd_configs:
      - names:
          - example.com
          - prometheus.io
        type: A
        port: 443
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
        replacement: https://$1/  # Make probe URL be like https://1.2.3.4:443/
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9115  # The blackbox exporter's real hostname:port.
      - source_labels: [__meta_dns_name]
        target_label: __param_hostname  # Make domain name become 'Host' header for probe requests
      - source_labels: [__meta_dns_name]
        target_label: vhost  # and store it in 'vhost' label

Permissions

The ICMP probe requires elevated privileges to function:

  • Windows: Administrator privileges are required.
  • Linux: either a user with a group within net.ipv4.ping_group_range, the CAP_NET_RAW capability or the root user is required.
    • Your distribution may configure net.ipv4.ping_group_range by default in /etc/sysctl.conf or similar. If not you can set net.ipv4.ping_group_range = 0 2147483647 to allow any user the ability to use ping.
    • Alternatively the capability can be set by executing setcap cap_net_raw+ep blackbox_exporter
  • BSD: root user is required.
  • OS X: No additional privileges are needed.

More Repositories

1

prometheus

The Prometheus monitoring system and time series database.
Go
52,273
star
2

node_exporter

Exporter for machine metrics
Go
10,062
star
3

alertmanager

Prometheus Alertmanager
Go
6,196
star
4

client_golang

Prometheus instrumentation library for Go applications
Go
5,113
star
5

client_python

Prometheus instrumentation library for Python applications
Python
3,726
star
6

jmx_exporter

A process for exposing JMX Beans via HTTP for Prometheus consumption
Java
2,866
star
7

pushgateway

Push acceptor for ephemeral and batch jobs.
Go
2,836
star
8

client_java

Prometheus instrumentation library for JVM applications
Java
2,116
star
9

mysqld_exporter

Exporter for MySQL server metrics
Go
1,976
star
10

snmp_exporter

SNMP Exporter for Prometheus
Go
1,489
star
11

statsd_exporter

StatsD to Prometheus metrics exporter
Go
884
star
12

cloudwatch_exporter

Metrics exporter for Amazon AWS CloudWatch
Java
854
star
13

procfs

procfs provides functions to retrieve system, kernel and process metrics from the pseudo-filesystem proc.
Go
732
star
14

docs

Prometheus documentation: content and static site generator
SCSS
619
star
15

haproxy_exporter

Simple server that scrapes HAProxy stats and exports them via HTTP for Prometheus consumption
Go
607
star
16

promlens

PromLens – The query builder, analyzer, and explainer for PromQL
TypeScript
507
star
17

client_ruby

Prometheus instrumentation library for Ruby applications
Ruby
499
star
18

consul_exporter

Exporter for Consul metrics
Go
419
star
19

client_rust

Prometheus / OpenMetrics client library in Rust
Rust
407
star
20

prom2json

A tool to scrape a Prometheus client and dump the result as JSON.
Go
336
star
21

graphite_exporter

Server that accepts metrics via the Graphite protocol and exports them as Prometheus metrics
Go
330
star
22

promu

Prometheus Utility Tool
Go
255
star
23

collectd_exporter

A server that accepts collectd stats via HTTP POST and exports them via HTTP for Prometheus consumption
Go
251
star
24

common

Go libraries shared across Prometheus components and libraries.
Go
250
star
25

influxdb_exporter

A server that accepts InfluxDB metrics via the HTTP API and exports them via HTTP for Prometheus consumption
Go
248
star
26

exporter-toolkit

Utility package to build exporters
Go
237
star
27

memcached_exporter

Exports metrics from memcached servers for consumption by Prometheus.
Go
176
star
28

test-infra

Prometheus E2E benchmarking tool
Go
147
star
29

compliance

A set of tests to check compliance with various Prometheus interfaces
Go
120
star
30

nagios_plugins

Nagios plugins for alerting on Prometheus query results
Shell
103
star
31

demo-site

Demo site auto-deployed with Ansible and Travis CI.
HTML
93
star
32

client_model

Data model artifacts for Prometheus.
Makefile
70
star
33

golang-builder

Prometheus Golang builder Docker images
Shell
69
star
34

codemirror-promql

PromQL support for the CodeMirror code editor
TypeScript
37
star
35

busybox

Prometheus Busybox Docker base images
Makefile
37
star
36

prometheus_api_client_ruby

A Ruby library for reading metrics stored on a Prometheus server
Ruby
34
star
37

talks

Track Prometheus talks
20
star
38

lezer-promql

A lezer-based PromQL grammar
JavaScript
11
star
39

circleci

8
star
40

host_exporter

See the "node_exporter" repository instead!
8
star
41

proposals

Design documents for Prometheus Ecosystem
Makefile
7
star
42

snmp_exporter_mibs

4
star
43

promci

GitHub Actions repository
4
star
44

kube-demo-site

Kubernetes Demo Site
Go
1
star