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

monody

v0.0.25

Published

A very simple sensors manager.

Downloads

54

Readme

Monody - a simple sensors manager

Features

Monody has 2 simple features:

  1. provide some basic sensors to get informations like the CPU usage, memory usage, disk usage
  2. allow for regular interrogation of those sensors

Stability

This package is in a prototyping stage and sensors support only Ubuntu hosts. Contact me for other platforms. I DO NOT recommend using this in production for now since there might be some breaking changes.

Node compatibility

Tested starting 4.4.0.

Installation

Install using npm:

npm install monody

Create a server.js file:

// file server.js
const monody = require('monody');
const sensors = require('monody/sensors');

// standalone usage of a sensor
sensors.cpu((cpu) => {
  console.log("current cpu usage", cpu);
});

// template for custom sensors
function customSensorTime(cb, options, taskStatus) {
  const responseData = {
    status: true,
    data: {
      time: new Date()
    },
    msg: "",
    extra: null
  }
  
  cb(responseData, "time");
}

// options for a http sensor
var options = {
  method: 'GET',
  host: 'nodejs.org',
  path: '/en/',
  port: 443
}

// general callback function to display data from the sensors
function callback(data, sensorName, taskStatus) {
  console.log(sensorName, data);
}

// tested with Ubuntu only 
// be carefull and give your sensors enough time to execute
monody.addTask(customSensorTime, callback, 1000);
monody.addTask(sensors.cpu, callback, 5000);
monody.addTask(sensors.mem, callback, 5000);
monody.addTask([sensors.http, options], callback, 5000);

// examples to get disk info and file size
// monody.addTask([sensors.disk, '/dev/sda'], callback, 5000);
// monody.addTask([sensors.fileInfo, 'your_file_name_here'], callback, 5000);

monody.start();

Launch with node server.js.

Anatomy of a sensor

A Monody sensor is a function that accepts two parameters:

  • a callback function
  • an options object

Monody will pass 3 parameters to the callback function:

  • a response object:
    • a status (boolean or string)
    • a data object
    • a string message generally used for informations about errors
    • an extra parameter which can be of any type
  • a tag name (string) used by the scheduler to identify the sensor
  • a taskStatus object

Let's see an example that can be used as a template for your own custom sensors.

function sensorTime(cb) {
  
  const responseData = {
    status: true,
    data: {
      time: new Date()
    },
    msg: "",
    extra: null
  }
   
  // monody will inject the task status as 3rd argument to the sensor function
  // therefore we will use the arguments array to pass it to the callback
  cb(responseData, "time", arguments[2]);
}

Available sensors

The package offers the following sensors:

  • cpu: cpu usage (float)
  • mem: mem usage (object)
  • disk: disk usage (float)
  • fileInfo: file informations(object)
  • (NEW) http: executes a http call (using node http.request) and returns the native response object

Roadmap

  • improve documentation
  • add more sensors
  • error handling
  • more examples

Contribute

The interest of this package will grow with the number of sensors. If you are interested in publishing new sensors, contact me: [email protected].

Changelog

  • 0.0.25 / 2016-09-04: improved http sensor. Returns req and res objects, body, statusCode and statusMessage
  • 0.0.24 / 2016-09-04: added a tonic example
  • 0.0.23 / 2016-09-04: added compatibility for node 4.4.x and greater
  • 0.0.22 / 2016-09-04: added new functions: pauseTask, resumeTask, addTaskAndLaunch, repetitions
  • 0.0.17 / 2016-09-01: documentation update
  • 0.0.16 / 2016-09-01: bug corrections
  • 0.0.15 / 2016-09-01: minor corrections
  • 0.0.14 / 2016-09-01: new http sensor, all sensors return a standard response object
  • 0.0.13 / 2016-08-29: documentation improvements