Skip to content

raylas/nextdns-exporter

Repository files navigation

nextdns-exporter

Main Go Report Card

A Prometheus exporter for NextDNS data.

Configuration

  • LOG_LEVEL (default: INFO)
  • METRICS_PORT (default: 9948)
  • METRICS_PATH (default: /metrics)
  • NEXTDNS_RESULT_WINDOW (default: -5m)
  • NEXTDNS_RESULT_LIMIT (default: 50)
  • NEXTDNS_PROFILE (required: docs)
  • NEXTDNS_API_KEY (required: docs)

For most accurate data, the scrape interval should match the value set via NEXTDNS_RESULT_WINDOW.

Recommended scrape timeout is 10 seconds.

Usage

Binary

Either download a recent release or compile the binary yourself (go build -o nextdns-exporter) and run:

export NEXTDNS_PROFILE=<profile_id>
export NEXTDNS_API_KEY=<api_key>
./nextdns-exporter
2022-11-19T12:39:34.479-0800 [INFO]  starting exporter: port=:9948 path=/metrics

Docker

docker run -d \
  -p 9948:9948 \
  -e NEXTDNS_PROFILE=<profile_id> \
  -e NEXTDNS_API_KEY=<api_key> \
  ghcr.io/raylas/nextdns-exporter

Compose

The following will create a local stack of the exporter, Prometheus, and Grafana:

NEXTDNS_PROFILE=<profile_id> \
NEXTDNS_API_KEY=<api_key> \
docker-compose up -d

Access Grafana by navigating to http://localhost:3000.

Note: Data will take a few minutes to trickle in.

Dashboard

A basic Grafana dashboard is found here.

Grafana dashboard