npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

prometheus-act-exporter

v3.1.2

Published

Exports ACT Fibernet data usage as prometheus metrics

Downloads

19

Readme

prometheus-act-exporter

Docker Image Version (latest semver) Docker Image Size (latest semver) 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. This only supports ACT Fibernet in India.

  • 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. 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.
  3. DISABLE_HEADLESS: If set, chrome will not launch in headless mode.

Usage

Docker

If running via Docker, here are some simple cookbook configurations:

docker run -it -p 3000:3000 -e captn3m0/prometheus-act-exporter

Run a simple test server locally in debug mode and test it on http://localhost:3000/metrics

Node

export DISABLE_HEADLESS=1
# Change to the correct invocation
export CHROME_BIN=$(which chromium)
npm install
node server.js
curl localhost:3000/metrics

LICENSE

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