Skip to content

Prometheus Exporter

Hunter Long edited this page Mar 5, 2019 · 8 revisions

Statping includes a prometheus exporter so you can have even more monitoring power with your services. The prometheus exporter can be seen on /metrics, simply create another exporter in your prometheus config. Use your Statping API Secret for the Authorization Bearer header, the /metrics URL is dedicated for Prometheus and requires the correct API Secret has Authorization header.

Grafana Dashboard

Statping has a Grafana Dashboard that you can quickly implement if you've added your Statping service to Prometheus. Import Dashboard ID: 6950 into your Grafana dashboard and watch the metrics come in!

Basic Prometheus Exporter

If you have Statping and the Prometheus server in the same Docker network, you can use the yaml config below.

scrape_configs:
  - job_name: 'statping'
    scrape_interval: 30s
    bearer_token: 'SECRET API KEY HERE'
    static_configs:
      - targets: ['statping:8080']

Remote URL Prometheus Exporter

This exporter yaml below has scheme: https, which you can remove if you arn't using HTTPS.

scrape_configs:
  - job_name: 'statping'
    scheme: https
    scrape_interval: 30s
    bearer_token: 'SECRET API KEY HERE'
    static_configs:
      - targets: ['status.mydomain.com']

/metrics Output

statping_total_failures 206
statping_total_services 4
statping_service_failures{id="1" name="Google"} 0
statping_service_latency{id="1" name="Google"} 12
statping_service_online{id="1" name="Google"} 1
statping_service_status_code{id="1" name="Google"} 200
statping_service_response_length{id="1" name="Google"} 10777
statping_service_failures{id="2" name="Statping.com"} 0
statping_service_latency{id="2" name="Statping.com"} 3
statping_service_online{id="2" name="Statping.com"} 1
statping_service_status_code{id="2" name="Statping.com"} 200
statping_service_response_length{id="2" name="Statping.com"} 2