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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@srikarp/system-health-monitor

v2.2.1

Published

A package which can be used to display the system health.

Downloads

11

Readme

System Health Monitor 🏥

A lightweight, framework-agnostic Node.js package to monitor server system health (CPU, Memory, Disk, Network) and display it in your frontend application.

System Health Dashboard

🚀 Features

  • Cross-Platform: Works on Windows, Linux, and macOS.
  • Deep Metrics: Uses native OS commands (wmic, top, df, netstat) for accurate data.
  • Framework Agnostic: Frontend component is pure Vanilla JS — works with React, Angular, Vue, or plain HTML.
  • Zero Dependencies (Runtime): Lightweight backend; Frontend dynamically loads Chart.js from CDN (if not present).
  • Real-time: Live updates with configurable polling intervals.
  • Network Monitoring: Real-time upload/download speeds.

📦 Installation

To use this package, install it in your Node.js backend project.

npm install @srikarp/system-health-monitor

Note: If you have a separate Frontend project (e.g., a React App created with CRA/Vite that runs on a different server), you should also install it there to get access to the client library.

🛠️ Integration Guide

This package consists of two parts: a Backend (to collect data) and a Frontend (to visualize it).

Part 1: Backend Setup (Node.js)

You need to expose an endpoint in your server that the frontend will check.

const express = require('express');
const monitor = require('@srikarp/system-health-monitor');

const app = express();

// 1. Start monitoring (begins data collection)
monitor.start();

// 2. Create the Data Endpoint (Returns JSON)
app.get('/_system-health', (req, res) => {
    res.json({
        data: monitor.getCurrentHealth().data,
        history: monitor.getHealthHistory(50)
    });
});

// 3. (Optional) Create an Instant Dashboard Page
// This lets you visit http://localhost:3000/dashboard to see the UI immediately.
app.get('/dashboard', (req, res) => {
    res.send(monitor.getSystemHealthUI('/_system-health'));
});

app.listen(3000, () => console.log('Server running on port 3000'));

Part 2: Frontend Integration

If you didn't use the "Instant Dashboard" above and want to integrate the graphs into your existing application, follow these steps.

Option A: Using ES Modules (React, Angular, Vue, Vite)

If you are using a bundler, import the client directly.

// In your React/Vue component file
import '@srikarp/system-health-monitor/client/system-health-client';

// ... inside your component ...
useEffect(() => {
    // 'SystemHealthClient' is now available globally
    SystemHealthClient.initMonitor('my-dashboard-container', {
        apiEndpoint: 'http://localhost:3000/_system-health' // Your backend URL
    });
}, []);

Option B: Plain HTML / Script Tag

If you are not using a build tool, you need to serve the client script from your backend or copy it to your public folder.

<!-- 1. Create a Container -->
<div id="health-dashboard"></div>

<!-- 2. Import the Client Script -->
<!-- Ensure this path points to where you are serving the file -->
<script src="/path/to/system-health-client.js"></script>

<!-- 3. Initialize -->
<script>
    window.addEventListener('load', () => {
        SystemHealthClient.initMonitor('health-dashboard', {
            apiEndpoint: '/_system-health'
        });
    });
</script>

⚙️ Configuration

Backend: monitor.start(intervalMs)

  • intervalMs (number): How often the backend collects metrics in milliseconds. Default: 4000.

Backend: monitor.getSystemHealthUI(apiEndpoint)

  • Returns a complete HTML string representing the dashboard, pre-wired to the given endpoint. useful for server-side rendering.

Frontend: SystemHealthClient.initMonitor(containerId, options)

  • containerId (string): The ID of the DOM element to render the dashboard into.
  • options (object):
    • apiEndpoint (string): The URL of your backend metrics endpoint. Default: /_system-health.
    • refreshInterval (number): Polling frequency in ms. Default: 2000.
    • chartColors (object): Custom hex colors for charts (e.g., { cpu: '#ff0000' }).

📊 Metrics Collected

| Metric | Windows | Linux | macOS | | :--- | :--- | :--- | :--- | | CPU Usage | wmic cpu get loadpercentage | top / Node Fallback | Node Fallback | | Memory | wmic OS | free -m | Node Fallback | | Disk Usage | wmic logicaldisk | df -k | df -h | | Network Traffic | netstat -e | /proc/net/dev | (Fallback) | | Processes | Node API | Node API | Node API | | GPU Info | wmic path win32_videocontroller | lspci | system_profiler |

📄 License

ISC