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

@remosi/rhsi-collector

v1.0.2

Published

Remosi Host System Information Collector

Downloads

2

Readme

rhsi-collector

This module collect host system information for telemetry proposes and developed for node.

const RHSI = require("@remosi/rhsi-collector");
const RHSinfo = RHSI({
  measurementInterval: 2000, // in Milliseconds
});

// Monitor CPU Load
setInterval(() => {
  console.log(RHSinfo("cpu").overal.usage);
}, 2000);

Notes that for first reading you sould wait minimum 1 second to calculate cpu load average.

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 10 or higher is required.

If this is a brand new project, make sure to create a package.json first with the npm init command.

Installation is done using the npm install command:

$ npm install @remosi/rhsi-collector

Get operating system information

let os = RHSInfo("os");

The output is an object that contains operating system information:

Example:

{
  "loadAVG": [0, 0, 0],
  "platform": "win32",
  "release": "10.0.19042",
  "type": "Windows_NT",
  "version": "Windows 10 Pro",
  "uptime": 602684,
  "architecture": "x64"
}

Get CPU information

let cpu = RHSInfo("cpu");

The output is an object that contains CPU information that contains overal CPU usage in percent and cores information and load:

Example:

{
  "overal": {
    "idle": [121687081.5, 121688007.5],
    "total": [130089656.25, 130090675.75],
    "usage": 10
  },
  "cores": [
    {
      "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
      "speed": 3408,
      "idle": [117276250, 117277109],
      "total": [131390030, 131391091],
      "usage": 20
    },
    {
      "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
      "speed": 3408,
      "idle": [124263546, 124264531],
      "total": [129921561, 129922577],
      "usage": 4
    },
    {
      "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
      "speed": 3408,
      "idle": [116963484, 116964265],
      "total": [129944170, 129945169],
      "usage": 22
    },
    {
      "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
      "speed": 3408,
      "idle": [124658140, 124659125],
      "total": [129854279, 129855295],
      "usage": 4
    },
    {
      "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
      "speed": 3408,
      "idle": [120373312, 120374250],
      "total": [129945623, 129946639],
      "usage": 8
    },
    {
      "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
      "speed": 3408,
      "idle": [124677593, 124678593],
      "total": [129854403, 129855419],
      "usage": 2
    },
    {
      "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
      "speed": 3408,
      "idle": [121125546, 121126453],
      "total": [129948841, 129949858],
      "usage": 11
    },
    {
      "model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
      "speed": 3408,
      "idle": [124158781, 124159734],
      "total": [129858343, 129859358],
      "usage": 7
    }
  ]
}

Get Network information

let network = RHSInfo("network");

The output is an object that contains network information that contains network interfaces, addresses and hostname:

Example:

{
  "netInterfaces": {
    "Loopback Pseudo-Interface 1": [
      {
        "address": "::1",
        "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
        "family": "IPv6",
        "mac": "00:00:00:00:00:00",
        "internal": true,
        "cidr": "::1/128",
        "scopeid": 0
      },
      {
        "address": "127.0.0.1",
        "netmask": "255.0.0.0",
        "family": "IPv4",
        "mac": "00:00:00:00:00:00",
        "internal": true,
        "cidr": "127.0.0.1/8"
      }
    ]
  },
  "hostname": "DESKTOP"
}

Get RAM information

let memory = RHSInfo("memory");

The output is an object that contains RAM information that contains free and total RAM installed:

Example:

{
  "freeMem": 8904847360,
  "totalMem": 17053687808
}