February 24, 2023

Reading Time:

Share

Using Prometheus Blackbox Exporter to Monitor URL Endpoints​

Share

One of the basic, but essential steps in monitoring your system is to treat it as a blackbox and to monitor the URL front door to your system. This strategy can also be used to measure the uptime of your system.

There are several popular open source observability tools out there which can be used to achieve this. In this blog, we will look at using Prometheus and Grafana as the underlying tools to accomplish this. We will discuss two approaches:

    1. Using docker-compose
    2. Using OpsVerse’s ObserveNow stack

Using docker-compose

Installing Prometheus and Grafana

The quickest way to run Prometheus and Grafana for testing purposes is to use docker-compose. The repo https://github.com/docker/awesome-compose/tree/master/prometheus-grafana has a good sample docker-compose setup that can be used for this purpose.

Check if everything is up and running:

The newly installed Grafana can be accessed at https://:3000. The default login credentials are admin/grafana.

Configure the blackbox exporter

Add a new file blackbox.yml with the following:

Edit the compose.yaml file and add the following:

Setup the scrape config by adding  the following to the end of the prometheus/prometheus.yml file:

Restart docker-compose:

This should start the following containers:

Visualize the collected metrics

Import the Grafana dashboard https://grafana.com/grafana/dashboards/7587-prometheus-blackbox-exporter/ to visualize the collected metrics:

Using OpsVerse’s ObserveNow Stack

OpsVerse’s ObserveNow is a full stack observability solution based on OSS tools that brings together metrics, logs and distributed traces under one platform. It makes the above steps much easier.

Launch the stack

Launch an instance of OpsVerse’s ObserveNow through the OpsVerse admin console. More info here: https://www.youtube.com/watch?v=WEfpPZt_x3s

Enable The Blackbox exporter agent

Prerequisites: The OpsVerse agent is installed in the cluster and the corresponding values.yaml is available on your machine. Add the following to the values.yaml:

Rerun the following command to update the agent’s installation with the blackbox configuration:

Refer to the official blackbox chart on prometheus github to check the values that can be overridden as part of the helm chart that is pre-installed on the OpsVerse-agent

https://github.com/prometheus-community/helm-charts/blob/main/charts/prometheus-blackbox-exporter/values.yaml
https://github.com/prometheus/blackbox_exporter/blob/master/example.yml

After enabling the exporter, add a custom scrape job as part of the victoria-metrics-agent field, defined in the same values file, similar to the following:

Notice how the scrape job contains the urls of the targets that need to be monitored.

It is important to configure the relabel_configs, especially the __address__ target label, which helps the prometheus agent to identify and scrape the blackbox service for metrics.

Visualize the collected metrics

OpsVerse’s ObserveNow stack already has prepackaged dashboards which should now display telemetry collected from the agent.


OpsVerse ObserveNow is a managed, battle-tested, scalable observability platform built on top of open source software and open standards. ObserveNow can be deployed as a cloud service or as a private SaaS installation within your own cloud (AWS/GCS/Azure). If you’d like to explore OpsVerse ObserveNow, click here to start a free trial today!

Share

Written by Amogh Prakash

Subscribe to the OpsVerse blog

New posts straight to your inbox