AmneziaWG exporter is a Prometheus exporter for gathering AmneziaWG client connection metrics.
amneziawg-exporter can optionally identify WireGuard clients using a client table. If this feature is enabled, clients are identified by their names; otherwise, they are marked as "unidentified."
amneziawg-exporter has three operating modes (AWG_EXPORTER_OPS_MODE
environment variable):
http
- Run an HTTP server onAWG_EXPORTER_HTTP_PORT
to make metrics accessible, like most exporters. Defaultmetricsfile
- Write metrics toAWG_EXPORTER_METRICS_FILE
instead of serving them on an HTTP port.oneshot
- Same as inmetricsfile
mode, but the service creates a metrics file and then shuts down. In Docker, you can use a volume to save the file on disk. It can then be used by node-exporter to serve your exporter metrics.grafana_cloud
- Sends metrics directly to Grafana Cloud using the provided API URL and token.
Tip
Open this link to read more about the textfile collector.
The following environment variables can be used to configure amneziawg-exporter.
Variable Name | Default Value | Description |
---|---|---|
AWG_EXPORTER_SCRAPE_INTERVAL | 60 | Interval for scraping WireGuard metrics (for the http mode). |
AWG_EXPORTER_HTTP_PORT | 9351 | Port for HTTP service. |
AWG_EXPORTER_METRICS_FILE | /tmp/prometheus/awg.prom | Path to the metrics file for Node exporter textfile collector. |
AWG_EXPORTER_OPS_MODE | http | Operation mode for the exporter (http , metricsfile , oneshot or grafana_cloud ). |
AWG_EXPORTER_AWG_SHOW_EXEC | "awg show" | Command to run the awg show command. |
AWG_GRAFANA_WRITE_URL | URL for sending metrics to Grafana Cloud (for grafana_cloud mode). |
|
AWG_GRAFANA_WRITE_TOKEN | Authorization token for Grafana Cloud (for grafana_cloud mode). |
|
AWG_GRAFANA_ADDITIONAL_LABELS | Additional labels to add when sending metrics to Grafana Cloud. |
Metric name | Labels | Description |
---|---|---|
awg_current_online | Current number of online users. | |
awg_dau | Daily active users. | |
awg_status | Exporter status. 1 - OK, 0 - not OK |
The Docker image is built using the Dockerfile available in this repository. You can easily obtain it from DockerHub by running the command docker pull amneziavpn/amneziawg-exporter.
You can use example docker-compose.yml with Docker Compose v2 to run AmneziaWG exporter:
# docker compose up -d
[+] Running 1/1
✔ Container amneziawg-exporter Started 0.2s
# docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
amneziawg-exporter amneziavpn/amneziawg-exporter:latest "/usr/bin/amneziawg-exporter" amneziawg-exporter 23 seconds ago Up 23 seconds
Tip
Run docker compose build
before, if you want to build image by yourself.