Endpoint monitoring with Blackbox Exporter
Blackbox Exporter is used for endpoint monitoring and can help generate meaningful uptime and availability metrics. Blackbox Exporter allows blackbox probing of endpoints over HTTP, HTTPS, DNS, TCP, ICMP and gRPC.
While most of the exporters use static configurations and then expose metrics accordingly, Blackbox Exporter works a little differently.
To setup Blackbox Exporter, we define modules which contain a set of targets/urls to monitor. Prometheus agent queries the blackbox exporter with these targets/urls which generates endpoint metrics like uptime, latency etc.
A sample configuration is shown below
Add the following YAML snippets to the OpsVerse agent's values.yaml file.
Run the below command:
Alternatively, you can install the Prometheus Blackbox Exporter on a single machine.
Prerequisite(s):
Run this command to install the Blackbox Exporter as a systemd unit:
- Edit the OpsVerse agent config file by using the following command:
- Add the Blackbox exporter job under scrape_configs and edit the fields as required.
- Edit the Blackbox exporter's config file by using the following command:
If the below content is alerady present in the config file, you can ignore the below step.
- Add the below module to Blackbox exporter's config file.
- Restart the prom-blackbox-exporter service and also the OpsVerse Agent by using the following commands:
- Check status to confirm everything is working fine.
You can configure custom modules in Blackbox exporter by defining the module in the blackbox config file and then updating scrape_configs section of agent-config.yaml to use the custom module. Some examples are provided below:
Add the following module to the modules section in /etc/opsverse/exporters/blackbox/config.yaml
Then restart the blackbox-exporter as described above and update scrape_configs in /etc/opsverse/agent-config.yaml by adding the custom module to the params block:
The exporter will now send the defined headers to every target it is monitoring
Add the following module to the modules section in /etc/opsverse/exporters/blackbox/config.yaml
Then restart the blackbox-exporter as described above and update scrape_configs in /etc/opsverse/agent-config.yaml by adding the custom module to the params block:
The exporter will now make a POST request with predefined body to every target it is monitoring
For more examples of custom blackbox-exporter modules, you can see the blackbox-exporter examples page.
OpsVerse ObserveNow provides an out of the box Blackbox Exporter/Endpoint Monitoring dashboard that can be used to provide a visual overview of your monitored endpoints.