Remnawave traffic reset monitor with Telegram alerts
684
Requires Remnawave Panel 3.x (users addressed by numeric id, not uuid).
Background monitor for Remnawave: polls the panel API and sends Telegram alerts when paid users have the wrong traffic reset strategy or have not had a calendar reset for too long.
Expected strategy and stale-reset threshold are configured per tariff tag in TAG_RULES.
Polls GET /api/users (paginated).
| Type | Condition |
|---|---|
wrong_strategy | trafficLimitStrategy does not match the strategy from TAG_RULES for the user tag |
stale_reset | expected strategy is MONTH, traffic was used, but lastTrafficResetAt is empty or older than the stale threshold |
Filters:
TAG_RULES are checkedWATCH_UNTAGGED_LIMITED=true - also checks limited users without a tag (UNTAGGED_LIMITED_RULE)trafficLimitBytes=0) are skippedEXPIRED users are skippedTAG_RULES (for example TRIAL) are skippedstale_reset with empty lastTrafficResetAt is not alerted if the account is younger than the stale thresholdAlerts link the subscription name to the user page in the panel. You must be logged into the panel (session cookie after sign-in).
Edit environment in drifter.compose.yaml and run:
docker compose -f drifter.compose.yaml up -d
Image on Docker Hub: sedyh/remna-traffic-drifter-bot.
Persistent data is stored in the /data volume (STATE_PATH, TELEGRAM_OFFSET_PATH by default).
| Variable | Description |
|---|---|
PANEL_URL | Remnawave panel base URL |
PANEL_TOKEN | API bearer token |
TELEGRAM_BOT_TOKEN | Telegram bot token |
TELEGRAM_CHAT_IDS | Comma-separated chat IDs; use chat_id:topic_id for forum topics |
TAG_RULES | Per-tag rules: TAG:STRATEGY or TAG:STRATEGY:STALE (comma-separated) |
TAG_RULES examples:
TAG_TARIFF_MIN:MONTH:35d - expect MONTH, stale reset after 35dTAG_TARRIF_PRO:MONTH - expect MONTH, stale threshold from STALE_RESET_AFTERMAX:NO_RESET - expect NO_RESET, no stale-reset checksStrategies: MONTH, NO_RESET. Stale accepts Go durations (35d, 720h).
| Variable | Default | Description |
|---|---|---|
TELEGRAM_SEND_INTERVAL | 3s | Delay between outbound messages |
TELEGRAM_PROXY_URL | - | HTTP(S) proxy for Telegram API |
POLL_INTERVAL | 15m | Panel poll interval |
STALE_RESET_AFTER | 35d | Default stale threshold when not set per tag |
UNTAGGED_LIMITED_RULE | MONTH | Rule for limited users without a tag (STRATEGY or STRATEGY:STALE) |
WATCH_UNTAGGED_LIMITED | true | Watch limited users without a tag |
PAGE_SIZE | 500 | /api/users page size |
STATE_PATH | /data/state.json | Alert deduplication state file |
TELEGRAM_OFFSET_PATH | /data/telegram_offset | Long polling offset file |
docker run (Docker Hub)docker run -d --name traffic-drifter --restart unless-stopped \
-e PANEL_URL=https://panel.example.com \
-e PANEL_TOKEN=secret \
-e TELEGRAM_BOT_TOKEN=secret \
-e TELEGRAM_CHAT_IDS=-1001234567890:289 \
-e TAG_RULES=TAG_TARIFF_MIN:MONTH:35d,TAG_TARRIF_PRO:MONTH:35d \
-v traffic-drifter-data:/data \
sedyh/remna-traffic-drifter-bot:latest
cp .env.example .env
go run ./cmd/traffic_drifter
task test
task build
task image
Docker Hub publish: push a v* git tag (secrets.DOCKERHUB_USERNAME, secrets.DOCKERHUB_TOKEN).
Content type
Image
Digest
sha256:2be4dbad5…
Size
3.2 MB
Last updated
about 1 month ago
docker pull sedyh/remna-traffic-drifter-bot