Skip to content

Commit

Permalink
issue #27: add mau
Browse files Browse the repository at this point in the history
  • Loading branch information
DarthSidious007 committed Oct 30, 2024
1 parent ecd8b85 commit 3540cbe
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 90,763 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
amneziawg-exporter
redis-data
8 changes: 5 additions & 3 deletions Dockerfile
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
FROM ubuntu:24.04 AS exporter
FROM ubuntu:24.04
RUN apt-get update && \
apt-get install python3-pip -y && \
rm -rf /var/lib/apt/lists/* && \
pip3 install --no-cache-dir --break-system-packages \
prometheus_client==0.20.0 \
python-decouple==3.8 \
requests==2.32.3
requests==2.32.3 \
redis==5.2.0
COPY --chmod=755 ./exporter.py ./Dockerfile /
CMD ["/exporter.py"]
ARG VERSION
LABEL org.opencontainers.image.version=$VERSION
LABEL org.opencontainers.image.source=https://github.com/amnezia-vpn/amneziawg-exporter
LABEL org.opencontainers.image.description='Prometheus Exporter for AmneziaWG Server'
LABEL org.opencontainers.image.authors='@shipilovds ([email protected])'
LABEL org.opencontainers.image.authors='@DarthSidious007 ([email protected])'
LABEL org.opencontainers.image.url=https://github.com/amnezia-vpn/amneziawg-exporter
LABEL org.opencontainers.image.documentation=https://github.com/amnezia-vpn/amneziawg-exporter/blob/main/README.md
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: all ci docker_build docker_retag docker_login docker_push

VERSION := 2.5.0
VERSION := 3.0.0
PROJECT_NAME ?= amneziavpn/amneziawg-exporter
DOCKER_BUILDKIT ?= 1
DOCKER_REGISTRY ?= docker.io
Expand All @@ -16,7 +16,7 @@ ci: DOCKER_TAG=$(VERSION)
ci: docker_build docker_push

docker_build:
docker build . -t $(DOCKER_IMAGE):$(DOCKER_TAG) --target exporter --build-arg VERSION=$(VERSION)
docker build . -t $(DOCKER_IMAGE):$(DOCKER_TAG) --build-arg VERSION=$(VERSION)

docker_retag:
docker tag $(DOCKER_IMAGE):$(DOCKER_TAG) $(DOCKER_IMAGE):latest
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,20 @@ The following environment variables can be used to configure amneziawg-exporter.
| 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" | Command to run the `awg show` command. |
| 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
Expand All @@ -60,11 +63,14 @@ You can use example [docker-compose.yml](docker-compose.yml) with Docker Compose

```sh
# docker compose up -d
[+] Running 1/1
✔ Container amneziawg-exporter Started 0.2s
[+] 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 "/usr/bin/amneziawg-exporter" amneziawg-exporter 23 seconds ago Up 23 seconds
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]
Expand Down
Loading

0 comments on commit 3540cbe

Please sign in to comment.