Enable build support by adding .onedev-buildspec.yml
src | Loading last commit info... | |
README.md | ||
package.json | ||
tsconfig.json |
README.md
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);
});