prometheus-act-exporter/README.md

73 lines
3.3 KiB
Markdown
Raw Permalink Normal View History

2018-06-04 07:50:44 +00:00
# prometheus-act-exporter
2022-06-24 07:21:36 +00:00
![Docker Image Version (latest semver)](https://img.shields.io/docker/v/captn3m0/prometheus-act-exporter) ![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/captn3m0/prometheus-act-exporter) [![npm version](https://badge.fury.io/js/prometheus-act-exporter.svg)](https://badge.fury.io/js/prometheus-act-exporter) [![License: WTFPL](https://img.shields.io/badge/License-WTFPL-blue.svg)](http://www.wtfpl.net/) [![CI](https://github.com/captn3m0/prometheus-act-exporter/actions/workflows/ci.yml/badge.svg)](https://github.com/captn3m0/prometheus-act-exporter/actions/workflows/ci.yml)
2018-06-30 22:17:34 +00:00
2021-08-12 04:51:55 +00:00
Exposes your current ACT FUP usage as prometheus metrics. Scrapes the data from the ACT Portal website by using [puppeteer](https://developers.google.com/web/tools/puppeteer/). This only supports [ACT Fibernet](https://www.actcorp.in/) in India.
2018-06-04 07:50:44 +00:00
2019-05-24 19:50:49 +00:00
- Supports flexibytes
- Reports aggregate metrics as well
- Only tested for ACT Bangalore connections.
2018-06-04 07:50:44 +00:00
## 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
2018-06-04 07:50:44 +00:00
# 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
2018-06-04 07:50:44 +00:00
```
# Using as a npm package
Install it with `npm i prometheus-act-exporter`.
2022-06-24 07:21:36 +00:00
See `test.js` for sample usage.
2018-06-04 07:50:44 +00:00
# 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"`
2021-08-12 04:51:55 +00:00
2. `CHROME_BIN`: Set Chrome/Chromium executable path. Helpful if you have chromium already installed and don't want puppeteer to download it again. You can set `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1` before running `npm install` to disable puppeteer's chromium download.
2018-06-04 07:50:44 +00:00
3. `DISABLE_HEADLESS`: If set, chrome will not launch in headless mode.
2018-06-04 08:08:40 +00:00
# Usage
## Docker
If running via Docker, here are some simple cookbook configurations:
2022-06-24 07:21:36 +00:00
```
wget https://github.com/tkp1n/chromium-ci/raw/41510dc154c4184f7e09461ba76f86f61c460070/seccomp/chromium.json
docker run --security-opt seccomp=chromium.json -it -p 3000:3000 -e captn3m0/prometheus-act-exporter
```
2022-06-24 07:21:36 +00:00
Note that the above uses a [minimal secure seccomp profile for running Chromium inside Docker](https://github.com/docker/for-linux/issues/496#issuecomment-441149510).
2021-12-19 10:06:03 +00:00
2022-06-24 07:21:36 +00:00
**Warning**: You should [not be running](https://ndportmann.com/chrome-in-docker/) this using `--privileged` or `--cap-add=SYS_ADMIN`, or `--no-sandbox`.
2021-12-19 10:06:03 +00:00
2018-06-04 08:08:40 +00:00
# LICENSE
This is licensed under WTFPL. See COPYING file for the full text.