Module for Node Js that captures information from the Operating System and the computer

0

How to obtain using Node Js the use of processing, memory, load average and operating system information?

I know that in Java, for example, the library "OperatingSystemMXBean" would like an equivalent.

The native module 'os' is a good option?

    
asked by anonymous 19.10.2017 / 23:09

1 answer

1

With the module you can get the CPU and memory information:

const os = require('os');

console.log(os.cpus());
console.log(os.totalmem());
console.log(os.freemem())

The os-utils module is also interesting, it works in much the same way:

const os = require('os-utils');

os.cpuUsage(function(v){
    console.log( 'CPU Usage (%): ' + v );
});

Disk usage information you can use diskspace :

const diskspace = require('diskspace');

diskspace.check('C', function (err, result) {
    console.log(JSON.stringify(result))
});
    
20.10.2017 / 15:06