This software exports traffic usage stats from 3X-UI to Prometheus, so you can monitor every client's usage of VPN traffic and online times.
# HELP down_bytes_total Bytes sent to the peer
# TYPE down_bytes_total counter
down_bytes_total{email="somebody"} 123456789
down_bytes_total{email="somebody_else"} 987654321
# HELP up_bytes_total Bytes received from the peer
# TYPE up_bytes_total counter
up_bytes_total{email="somebody"} 123456789
up_bytes_total{email="somebody_else"} 987654321
# HELP is_online Is the peer online
# TYPE is_online gauge
is_online{email="somebody"} 1
is_online{email="somebody_else"} 0
linux/amd64
and linux/arm64
builds are available.
docker run --name exporter -p 3000:3000 m4l3vich/3x-ui-prometheus-exporter
Metrics will be available at http://localhost:3000/metrics
Required environment variables:
Variable | Description | Example |
---|---|---|
XUI_ORIGIN | 3X-UI panel URL | https://example.org/3x-ui/ |
XUI_USERNAME | Username for logging in to the panel | somebody |
XUI_PASSWORD | Password for logging in to the panel | somepassword |
Optional environment variables:
Variable | Description | When to use |
---|---|---|
XUI_LOGIN_SECRET | Additional secret string for logging in to the panel | If such secret was set in the panel's settings |
XUI_BASIC_AUTH | username:password pair for the web server | If the web server (e.g. reverse proxy) requires HTTP Basic Auth to access the panel |
You will need latest Node.js LTS and PNPM.
- Clone this repo:
git clone https://github.com/m4l3vich/3x-ui-prometheus-exporter; cd 3x-ui-prometheus-exporter
- Install dependencies:
pnpm install
- Build the app:
pnpm build
- Create a
.env
file with all the environment variables - Run the app:
pnpm start
ornode build/index.js