node-usage
linux process usage lookup with nodejs
- With
node-usage
we can lookup cpu and memory usage of any accessible process on the system. - This is 98% JavaScript and logic is based on procps
Example
Code
var usage = require('usage');
var pid = process.pid
usage.lookup(pid, function(err, result) {
});
Result Object
{
cpu: 10.6,
memory: 100065280
}
Motivation
- Some NodeJS PAAS providers do not expose us an interface to monitor CPU and Memory usage of our apps.
- They asks us to go for somewhere else for that which I don't want to go (or simply I cannot go)
- So
node-usage
was born to tackle on this.