Exploring the different ways to set up Blackbox exporter/Prometheus for endpoint monitoring.
Blackbox exporter can be first installed by either installing the binary from here or cloning the repo. Afterwards, proceed with the following:
-
Modify module configuration -
./configs/blackbox.yml
. -
Run Blackbox Exporter.
Running from Binary
./blackbox_exporter --config.file=./configs/blackbox.yml
Running from repo
cd blackbox_exporter/ && go run main.go --config.file=./configs/blackbox.yml
Similarly, you can choose to either install the binary from here or clone the repo.
-
Define configuration files. This project explores the following three implementations, which are instrumented using three different configuration files.
./configs/static.yml
- Defines static list of targets./configs/service_discovery.yml
- Defines a HTTP Service Discovery to fetch dynamic targets./configs/service_discovery_custom_labels.yml
- Monitoring HTTP Service Discovery to fetch dynamic targets with additional custom labels.
-
Run Prometheus.
Running from Binary
./prometheus --config.file=./configs/static.yml
Build and run manually
cd prometheus/ && make build
./prometheus --config.file=./configs/static.yml
For this project, a simple backend script in Go is used to simulate HTTP SD endpoints. They are are discoverable on localhost:8000/targets
and localhost:8000/targets_custom
.
cd backend/ && go run main.go