Skip to content

Web Services Monitoring — Overview

Purpose

This runbook covers public web-service monitoring with Prometheus and Blackbox Exporter.

The monitoring checks:

  • HTTP/HTTPS availability.
  • HTTP response status.
  • TLS certificate expiration.
  • Certificate expiration at three escalation levels: 30 days, 7 days, and 2 days.

Use the fleet-wide Blackbox Exporter dashboard for a consolidated view of all Discovery-managed HTTP/HTTPS probes. The resource-scoped Web Services dashboard remains available from Resource Detail for inspecting one resource at a time.

Monitoring flow

Public web service
       |
       v
Blackbox Exporter
       |
       v
Prometheus
       |
       +--> Availability / HTTP metrics
       |
       +--> TLS certificate expiration
       |
       v
Alertmanager
       |
       v
Operator notification
Alert Threshold Severity
WebServiceSSLCertificateExpiring30Days < 30 days warning
WebServiceSSLCertificateExpiring7Days < 7 days warning
WebServiceSSLCertificateExpiring2Days < 2 days critical

The 30-day and 7-day alerts provide advance warning. The 2-day alert is critical.

Identify the monitored target

Targets are defined in:

config/prometheus/targets/discovery/blackbox-web-services.yml

Check that Prometheus sees the target:

curl -sS http://localhost:9090/api/v1/targets |
  jq '
    .data.activeTargets[]
    | select(.labels.job == "blackbox-web-services")
    | {
        health,
        scrapeUrl,
        instance: .labels.instance,
        lastError
      }
  '

A healthy target should report health: "up" and an empty lastError.

Check certificate expiration

curl -sS --get   http://localhost:9090/api/v1/query   --data-urlencode   'query=probe_ssl_earliest_cert_expiry{job="blackbox-web-services"}' |
  jq '
    .data.result[] |
    {
      instance: .metric.instance,
      expires_at: (.value[1] | tonumber | strftime("%Y-%m-%dT%H:%M:%SZ")),
      expires_in_days: ((.value[1] | tonumber) - now) / 86400
    }
  '

Troubleshooting Blackbox Exporter

Check status:

docker compose ps blackbox-exporter

Check logs:

docker compose logs --tail=100 blackbox-exporter

Verify the configuration mount:

docker inspect observability-platform-blackbox-exporter-1   --format '{{range .Mounts}}{{println .Source "->" .Destination}}{{end}}'

The configuration must be available inside the container at:

/etc/blackbox_exporter/config.yml

Probe from the Prometheus network

This tests the monitoring path from Prometheus to Blackbox Exporter:

docker exec observability-platform-prometheus-1   wget -qO-   'http://blackbox-exporter:9115/probe?target=https%3A%2F%2Fexample.example&module=https_2xx' |
  grep -E 'probe_success|probe_http_status_code|probe_ssl_earliest_cert_expiry'

A successful HTTPS probe should include:

probe_http_status_code 200
probe_success 1

Prometheus rule validation

docker exec observability-platform-prometheus-1   sh -c 'promtool check rules $(find /etc/prometheus/rules -type f -name "*.yml")'

Check that the web-services group is loaded:

curl -sS http://localhost:9090/api/v1/rules |
  jq -r '
    .data.groups[] |
    [.name, (.rules | length)] |
    @tsv
  '

Expected:

web-services    3

Inspect the three alerts:

curl -sS http://localhost:9090/api/v1/rules |
  jq '
    .data.groups[]
    | select(.name == "web-services")
    | .rules[]
    | select(.name | startswith("WebServiceSSLCertificateExpiring"))
    | {name, state, health}
  '

Operational note

Keep public service endpoints in Prometheus target configuration. Blackbox Exporter defines probe behavior; it should not contain the individual list of services.