hwmon

1.1.2 • Public • Published

hwmon

hwmon is a resource monitor written for node.js systems running on Linux.

hwmon emits an event for cpu, memory, and disk usage on a user-defined interval.

The current version is simply a wrapper around the 'df' and 'iostat' commands, and the contents of /proc/meminfo on Linux.

Usage:

var Hwmon = require('./index');
var hwmon = new Hwmon({interval: 2000});

hwmon.on('iostat', function(data){
  console.log('iostat:',data);
});

hwmon.on('meminfo', function(data){
  console.log('meminfo:',data);
});

hwmon.on('df', function(data){
  console.log('df:',data);
});

hwmon.start();

Output:

free: { mem:
   { total: 4048032,
     used: 233772,
     free: 3814260,
     shared: 420,
     buffers: 20768,
     cached: 109580 },
  swap: { total: 4191228, used: 0, free: 4191228 } }

iostat: { 'avg-cpu:':
   { '%user': 0.13,
     '%nice': 0,
     '%system': 0.25,
     '%iowait': 0,
     '%steal': 0,
     '%idle': 99.62 },
  devices: { sda: { tps: 0, 'kB_read/s': 0, 'kB_wrtn/s': 0, kB_read: 0, kB_wrtn: 0 } } }

  df: { '/dev/sda1':
   { '1M-blocks': '26079',
     Used: '1244',
     Available: '23488',
     'Use%': '6%',
     Mounted: '/' } }

Dependents (0)

Package Sidebar

Install

npm i hwmon

Weekly Downloads

2

Version

1.1.2

License

MIT

Last publish

Collaborators

  • niahmiah