Go to file
Nemo 5b93267f0c Add CHROME_BIN environment in Docker
- The upstream docker image uses Yarn, while I use npm and
  that screws up everything
2019-05-12 22:05:44 +05:30
hooks Update Dockerfile to include labels 2018-07-01 03:24:35 +05:30
.dockerignore Prepare for npm publish 2018-06-04 13:23:04 +05:30
.editorconfig [deps] Bumps puppeteer to 1.8 2019-03-14 08:07:19 +05:30
.gitignore Initial commit 2018-06-03 02:07:29 +05:30
.npmignore Prepare for npm publish 2018-06-04 13:23:04 +05:30
CHANGELOG.md 📝 Updates CHANGELOG 2019-05-12 21:40:22 +05:30
COPYING Initial Dockerfile 2018-06-04 14:25:02 +05:30
Dockerfile Add CHROME_BIN environment in Docker 2019-05-12 22:05:44 +05:30
METRICS.md Adds documentation and drops `usage` from total_bytes metrics 2018-07-01 03:13:48 +05:30
README.md [docs] Adds badges to README 2018-07-01 03:47:34 +05:30
index.js Update dependencies and version bump 2019-05-12 12:51:45 +05:30
package-lock.json Update dependencies and version bump 2019-05-12 12:51:45 +05:30
package.json Update dependencies and version bump 2019-05-12 12:51:45 +05:30
prom.js Adds documentation and drops `usage` from total_bytes metrics 2018-07-01 03:13:48 +05:30
server.js Switches to new prometheus formatter 2018-07-01 03:06:22 +05:30

README.md

prometheus-act-exporter

npm version License: WTFPL PRs Welcome

Exposes your current ACT FUP usage as prometheus metrics. Scrapes the data from the ACT Portal website by using puppeteer.

  • Supports flexibytes
  • Reports aggregate metrics as well
  • Only tested for ACT Bangalore connections.

Metrics

Sample:

# HELP act_fup_live_usage_bytes ACT live usage in bytes (precision GB)
# TYPE act_fup_live_usage_bytes gauge
act_fup_live_usage_bytes 0

# HELP act_fup_live_total_bytes ACT live usage in bytes (precision GB)
# TYPE act_fup_live_total_bytes gauge
act_fup_live_total_bytes 800000000

# HELP act_fup_flexibytes_usage_bytes ACT flexibytes usage in bytes (precision GB)
# TYPE act_fup_flexibytes_usage_bytes gauge
act_fup_flexibytes_usage_bytes 102580000

# HELP act_fup_flexibytes_total_bytes ACT flexibytes usage in bytes (precision GB)
# TYPE act_fup_flexibytes_total_bytes gauge
act_fup_flexibytes_total_bytes 100000000

# HELP act_fup_aggregate_usage_bytes ACT aggregate usage in bytes (precision GB)
# TYPE act_fup_aggregate_usage_bytes gauge
act_fup_aggregate_usage_bytes 102580000

# HELP act_fup_aggregate_total_bytes ACT aggregate usage in bytes (precision GB)
# TYPE act_fup_aggregate_total_bytes gauge
act_fup_aggregate_total_bytes 900000000

Using as a npm package

Install it with npm i prometheus-act-exporter.

const act = require('prometheus-act-exporter')
let m = await act.getUsage();
// Returns
// {
//   live: { usedBytes: 0, totalBytes: 800000000 },
//   flexibytes: { usedBytes: 102580000, totalBytes: 100000000 },
//   aggregate: { usedBytes: 102580000, totalBytes: 900000000 }
// }
// calculations made assuming ACT is using SI GB (exactly 1 billion bytes)

Configuration

You can pass the following environment variables:

  1. PROXY_SERVER: Use a proxy server to connect to ACT. Use a socks5 proxy, since ACT returns a 403 if you try to use a CONNECT proxy. export PROXY_SERVER="socks5://10.8.0.14:1080"
  2. CHROME_BIN: Set Chrome/Chromium executable path.
  3. DISABLE_HEADLESS: If set, chrome will not launch in headless mode.

LICENSE

This is licensed under WTFPL. See COPYING file for the full text.

The canonical URL for this project is https://git.captnemo.in/nemo/prometheus-act-exporter.