Just a simple way to autogenerate prometheus targets, based on Remnawave panel (https://docs.rw).
1.5K
Just a simple way to autogenerate prometheus targets, based on Remnawave panel (https://docs.rw).
Before you begin, ensure you have the following:
Copy .env.example to .env and fill in your values:
# Remnawave API Configuration
REMNA_API_URL=https://remna.docs.rw/api
REMNA_API_TOKEN=your_api_token_here
# Update interval in seconds (how often to regenerate targets)
UPDATE_INTERVAL=600
# Enable/disable generators
ENABLE_NODE_EXPORTER=true
ENABLE_BLACKBOX_EXPORTER=true
# Node exporter ports (comma-separated)
NODE_EXPORTER_PORTS=9100
| Variable | Description | Default | Required |
|---|---|---|---|
REMNA_API_URL | Remnawave API endpoint to fetch targets from | - | Yes |
REMNA_API_TOKEN | API authentication token | - | Yes |
UPDATE_INTERVAL | Interval in seconds between target updates | 600 | No |
ENABLE_NODE_EXPORTER | Enable/disable Node Exporter target generation | true | No |
ENABLE_BLACKBOX_EXPORTER | Enable/disable Blackbox Exporter target generation | true | No |
NODE_EXPORTER_PORTS | Comma-separated list of ports for Node Exporter | 9100 | No |
services:
remnawave-prometheus:
image: hteppl/remnawave-prometheus:latest
container_name: remnawave-prometheus
restart: unless-stopped
env_file:
- .env
volumes:
- ./generated:/app/generated
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
cp .env.example .env
nano .env # or use your preferred editor
docker compose up -d && docker compose logs -f
git clone https://github.com/hteppl/remnawave-prometheus.git
cd remnawave-prometheus
python -m venv .venv
source .venv/bin/activate # Linux/macOS
# or
.venv\Scripts\activate # Windows
pip install -r requirements.txt
cp .env.example .env
python -m src
Initial Fetch - On startup, the service fetches all nodes from the Remnawave API
Target Generation - Based on configuration, it generates target files for Node Exporter and/or Blackbox Exporter
Continuous Updates - The service polls the Remnawave API at the configured interval (UPDATE_INTERVAL) and
regenerates targets
Prometheus Integration - Prometheus reads the generated target files and automatically discovers new nodes
The service generates two target files:
generated/blackbox.yml - Targets for Blackbox Exportergenerated/node.yml - Targets for Node ExporterExample prometheus.yml configuration:
scrape_configs:
- job_name: "node_servers"
file_sd_configs:
- files:
- /etc/generated/node.yml
refresh_interval: 10m
- job_name: "blackbox_https_probes"
metrics_path: /probe
params:
module: [ http_2xx ]
file_sd_configs:
- files:
- /etc/generated/blackbox.yml
refresh_interval: 10m
relabel_configs:
- source_labels: [ __address__ ]
target_label: __param_target
- source_labels: [ __param_target ]
target_label: instance
- target_label: __address__
replacement: blackbox_exporter:9115
Prometheus will automatically reload the targets files at the specified interval. Make sure refresh_interval matches
or is less than or equal to your UPDATE_INTERVAL.
Monitor logs to diagnose issues:
# Docker
docker compose logs -f
# Manual
# Logs are output to stdout with timestamps
This project is licensed under the GNU General Public License v3.0.
Content type
Image
Digest
sha256:986b5832a…
Size
48.9 MB
Last updated
10 months ago
docker pull hteppl/remnawave-prometheus