NPM Package that reads data from a Prometheus Instance with Node Exporter
Find a file
2025-06-16 01:53:31 +02:00
src added readme 2025-06-16 01:50:46 +02:00
package.json version bump 2025-06-16 01:53:31 +02:00
README.md added readme 2025-06-16 01:50:46 +02:00
tsconfig.json initial commit 2025-06-16 01:11:24 +02:00

promstats

📊 Access Prometheus + Node Exporter hardware metrics through simple JavaScript functions.

promstats is a lightweight Node.js package that fetches and parses hardware and system metrics (like CPU and system info) from a Prometheus server running with Node Exporter. It wraps raw metrics into clean JS functions so you can integrate them into your apps with ease.


Features

  • 🔧 Fetches real-time metrics from Prometheus
  • 📦 Simple API for accessing CPU and system-level data
  • 🧠 Intelligent parsing of Node Exporter metrics
  • Written in TypeScript

🚀 Installation

npm install promstats

🔧 Configuration

Before using any functions, you must configure the Prometheus endpoint:

import { setUrlEndpoint } from 'promstats';
setUrlEndpoint('http://localhost:9090');

Usage:

import { setUrlEndpoint, CPU, RAM, System } from 'promstats';

setUrlEndpoint('http://localhost:9090');

CPU.getCpuLoad().then(load => {
  console.log('CPU Load:', load);
});

RAM.getUsedMemory().then(used => {
  console.log('Used Memory:', used);
});

System.getOsName().then(os => {
  console.log('OS Name:', os);
});