amnezia-vpn / amneziawg-exporter

amneziawg-exporter
GNU General Public License v3.0
8 stars 2 forks source link

License Docker Latest Version Docker Image Size Docker Pulls

AmneziaWG exporter

AmneziaWG exporter is a Prometheus exporter for gathering AmneziaWG client connection metrics.

Features and limitations

Client identification

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."

Operating modes

amneziawg-exporter has three operating modes (AWG_EXPORTER_OPS_MODE environment variable):

[!TIP] Open this link to read more about the textfile collector.

Configuration

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_LISTEN_ADDR 0.0.0.0 Listen address 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 all dump" 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.
AWG_EXPORTER_REDIS_HOST localhost Redis server host to store peers data
AWG_EXPORTER_REDIS_PORT 6379 Redis server port to store peers data
AWG_EXPORTER_REDIS_DB 0 Redis server db number to store peers data

Metrics

Metric name Labels Description
awg_current_online Current number of online users.
awg_dau Daily active users.
awg_mau Monthly active users.
awg_status Exporter status. 1 - OK, 0 - not OK

Docker image

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.

Example usage

You can use example docker-compose.yml with Docker Compose v2 to run AmneziaWG exporter:

# docker compose up -d
[+] Running 3/3
 ✔ Network amneziawg-exporter_default  Created          0.2s
 ✔ Container amneziawg-exporter-redis  Started          0.1s
 ✔ Container amneziawg-exporter        Started          0.1s
# docker compose ps
NAME                 IMAGE                                          COMMAND                         SERVICE              CREATED          STATUS          PORTS
amneziawg-exporter         amneziavpn/amneziawg-exporter:latest   "/exporter.py"           amneziawg-exporter         15 seconds ago   Up 14 seconds   0.0.0.0:9351->9351/tcp, :::9351->9351/tcp
amneziawg-exporter-redis   redis:alpine                           "docker-entrypoint.s…"   amneziawg-exporter-redis   15 seconds ago   Up 14 seconds   6379/tcp

[!TIP] Run docker compose build before, if you want to build image by yourself.