Sign inSign up

m4l3vich/3x-ui-prometheus-exporter

By m4l3vich

Updated 3 months ago

Image
1

1.9K

m4l3vich/3x-ui-prometheus-exporter repository overview

3X-UI Prometheus Exporter

Typescript Docker Hub JavaScript Style Guide Docker Image Size

GitHub Repo

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.

Available metrics (example response)

# 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:

VariableDescriptionExample
XUI_ORIGIN3X-UI panel URLhttps://example.org/3x-ui/
XUI_USERNAMEUsername for logging in to the panelsomebody
XUI_PASSWORDPassword for logging in to the panelsomepassword

Optional environment variables:

VariableDescriptionWhen to use
XUI_LOGIN_SECRETAdditional secret string for logging in to the panelIf such secret was set in the panel's settings
XUI_BASIC_AUTHusername:password pair for the web serverIf the web server (e.g. reverse proxy) requires HTTP Basic Auth to access the panel

Running locally

You will need latest Node.js LTS and PNPM.

  1. Clone this repo: git clone https://github.com/m4l3vich/3x-ui-prometheus-exporter; cd 3x-ui-prometheus-exporter
  2. Install dependencies: pnpm install
  3. Build the app: pnpm build
  4. Create a .env file with all the environment variables
  5. Run the app: pnpm start or node build/index.js

Tag summary

Content type

Image

Digest

sha256:a385d758f

Size

58.5 MB

Last updated

3 months ago

docker pull m4l3vich/3x-ui-prometheus-exporter