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

node-red-contrib-cpu

v0.0.4

Published

A Node Red node to monitor CPU usage

Downloads

974

Readme

node-red-contrib-cpu

A Node Red node for monitoring CPU usage

Install

Run the following npm command in your Node-RED user directory (typically ~/.node-red):

npm install node-red-contrib-cpu

Usage

This node will monitor the CPU usage, based on the Node.js OS Library.

An example flow:

Flow

A trigger message should be send to the input, every time the CPU usage should be recalculated. The calculated CPU usage is the average usage since the previous calculation, so the calculated value will become more accurate when the period between successive calculations is small. As a result, it is advised to apply a trigger message every second on the input.

Single output message for overall cpu usage

When this option is selected, a single output message will be generated that contains the overall CPU usage (with topic 'overall'). The overall CPU usage is calculated as the average usage of all cores:

Formula

Simon Hailes adviced me to add this option, since the graphs per core can become too noisy. For example, from following graph you might conclude (incorrectly!) that video processing (using the OpenCv library) uses nicely all 4 cores of a Raspberry Pi:

Formula

However when looking at the overall CPU usage, it becomes clear that only 25% of the Raspberry Pi CPU resources is being used:

Formula

This means that the library uses all 4 available cores, but in total only 25% of the 4 cores...

There will be a single output message, containing the overall data of all cores:

  • msg.payload is the overall usage percentage (sum of usage of all cores / number of cores)
  • msg.speed is processor speed (in MHz)
  • msg.topic is a fixed text (overall)
  • msg.model is the CPU model

Separate output message for each core

When this option is selected, an output message will be generated for each core individually. Since every core gets it's own topic (core_xxx), it becomes very easy to display all the cores in a single graph on the dashboard:

Graph with multiple cores

The output message for each core will look like this:

  • msg.payload is the core usage (as a percentage)
  • msg.speed is processor speed (in MHz)
  • msg.topic is the name of the (logical) CPU core (core_xxx)
  • msg.model is the CPU model

This is an example of such an output message:

Debug message

Single output message with array of core usages

When this option is selected, a single output message will be generated that contains an array of all CPU usages (with topic 'all_cores').

  • msg.payload is the array with information of all the available cores:
    • name is the name of the (logical) CPU core (core_xxx)
    • usage is the core usage (as a percentage)
    • model is the CPU model
    • speed is the processor speed (in MHz)
  • msg.topic is a fixed text (all_cores)

Single output message with core temperature(s)

When this option is selected, a single output message will be generated that contains the temperature values in °C (with topic 'temperature').

Temperature graph

The output message will look like this:

  • msg.payload is the main (average) temperature
  • msg.max is maximum temperature
  • msg.cores is an array of temperatures of all cores
  • msg.topic is a fixed text (temperature)

CAUTION: the temperature values are not available on all systems (e.g. on Sun systems)! And on some systems the msg.cores array will be empty (e.g. on Raspberry Pi 3), but instead the main temperature might be available.

Core definition

As mentioned before, data will be outputted for every core. However what does a core represent?

In case of a system with N processors (and M cores in each processor), the total number of physical cores in the graph will be NxM.

However sometimes we will get much more virtual cores on the output (compared to the number of physical cores). This could be the case for example with processors that support Hyper threading.

Troubleshooting

This node can be used to detect performance issues easily, without having to install extra third-party tools.

As a starting point (to compare your own CPU usage graph), a basic Node-Red flow uses very few core resources (except from the deploy period):

Basic flow graph

Alternative

The The node-red-contrib-os node also contains a 'cpus' node, which can be used to get the same kind of information. However there are some differences between both nodes:

| | node-red-contrib-os (cpus) | node-red-contrib-cpu | | ------------------ |:--------------------------------------:| :--------------------:| | Multiple cores | all in 1 msg | separate messages | | Measurement start | system startup | previous calculation | | Output value | multiple values (idle, user, sys ...) | single percentage |

Summarized the node-red-contrib-cpu node is some kind of convenience node, that takes care of all calculations in case you want to live monitor the CPU usages.