systeminformation
Advanced tools
Comparing version 3.8.1 to 3.9.0
@@ -91,2 +91,3 @@ # Changelog | ||
| -------------- | -------------- | -------- | | ||
| 3.9.0 | 2016-11-11 | added MAC address to networkInterfaces, fixed currentLoad | | ||
| 3.8.1 | 2016-11-04 | updated docs | | ||
@@ -93,0 +94,0 @@ | 3.8.0 | 2016-11-04 | added dockerContainerProcesses | |
@@ -84,20 +84,21 @@ 'use strict'; | ||
// version date comment | ||
// 3.8.1 2016-11-04 updated docs | ||
// 3.8.0 2016-11-04 added dockerContainerProcesses | ||
// 3.7.1 2016-11-03 code refactoring | ||
// 3.7.0 2016-11-02 extended docker stats, and no longer relying on curl (version conflicts) | ||
// 3.6.0 2016-09-16 added versions (kernel, ssl, node, npm, pm2, ...) | ||
// 3.5.1 2016-09-14 bugfix graphics info | ||
// 3.5.0 2016-09-14 added graphics info (controller, display) | ||
// 3.4.4 2016-09-02 tiny fixes system.model, getDefaultNetworkInterface | ||
// 3.4.3 2016-09-02 tiny bug fix fsStats, disksIO OSX | ||
// 3.4.2 2016-09-01 improved default network interface | ||
// 3.4.1 2016-08-30 updated docs | ||
// 3.4.0 2016-08-30 rewritten current process cpu usage (linux) | ||
// 3.3.0 2016-08-24 added process list | ||
// 3.2.1 2016-08-20 updated docs, improvement system | ||
// 3.2.0 2016-08-19 added battery info | ||
// 3.1.1 2016-08-18 improved system and os detection (vm, ...), bug fix disksIO | ||
// 3.1.0 2016-08-18 added docker stats | ||
// 3.0.1 2016-08-17 Bug-Fix disksIO, users, updated docs | ||
// 3.9.0 2016-11-11 added MAC address to networkInterfaces, fixed currentLoad | ||
// 3.8.1 2016-11-04 updated docs | ||
// 3.8.0 2016-11-04 added dockerContainerProcesses | ||
// 3.7.1 2016-11-03 code refactoring | ||
// 3.7.0 2016-11-02 extended docker stats, and no longer relying on curl (version conflicts) | ||
// 3.6.0 2016-09-16 added versions (kernel, ssl, node, npm, pm2, ...) | ||
// 3.5.1 2016-09-14 bugfix graphics info | ||
// 3.5.0 2016-09-14 added graphics info (controller, display) | ||
// 3.4.4 2016-09-02 tiny fixes system.model, getDefaultNetworkInterface | ||
// 3.4.3 2016-09-02 tiny bug fix fsStats, disksIO OSX | ||
// 3.4.2 2016-09-01 improved default network interface | ||
// 3.4.1 2016-08-30 updated docs | ||
// 3.4.0 2016-08-30 rewritten current process cpu usage (linux) | ||
// 3.3.0 2016-08-24 added process list | ||
// 3.2.1 2016-08-20 updated docs, improvement system | ||
// 3.2.0 2016-08-19 added battery info | ||
// 3.1.1 2016-08-18 improved system and os detection (vm, ...), bug fix disksIO | ||
// 3.1.0 2016-08-18 added docker stats | ||
// 3.0.1 2016-08-17 Bug-Fix disksIO, users, updated docs | ||
// 3.0.0 2016-08-03 new major version 3.0 | ||
@@ -104,0 +105,0 @@ // 2.0.5 2016-02-22 some more tiny correction ... |
@@ -99,2 +99,3 @@ 'use strict'; | ||
let ip6 = ''; | ||
let mac = ''; | ||
if (ifaces.hasOwnProperty(dev)) { | ||
@@ -108,5 +109,6 @@ ifaces[dev].forEach(function (details) { | ||
} | ||
mac = details.mac | ||
}); | ||
let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : null; | ||
result.push({ iface: dev, ip4: ip4, ip6: ip6, internal: internal }) | ||
result.push({ iface: dev, ip4: ip4, ip6: ip6, mac : mac, internal: internal }) | ||
} | ||
@@ -113,0 +115,0 @@ } |
@@ -43,3 +43,8 @@ 'use strict'; | ||
guest_nice: 0, | ||
all: 0 | ||
all: 0, | ||
ms: 0, | ||
currentload: 0, | ||
currentload_user: 0, | ||
currentload_nice: 0, | ||
currentload_system: 0 | ||
}; | ||
@@ -54,11 +59,17 @@ | ||
process.nextTick(() => { | ||
let result = {}; | ||
let loads = os.loadavg().map(function (x) { return x / util.cores() }); | ||
result.avgload = parseFloat((Math.max.apply(Math, loads)).toFixed(2)); | ||
result.currentload = -1; | ||
result.currentload_user = -1; | ||
result.currentload_nice = -1; | ||
result.currentload_system = -1; | ||
let avgload = parseFloat((Math.max.apply(Math, loads)).toFixed(2)); | ||
let result = { | ||
avgload: avgload, | ||
currentload: _current_cpu.currentload, | ||
currentload_user: _current_cpu.currentload_user, | ||
currentload_nice: _current_cpu.currentload_nice, | ||
currentload_system: _current_cpu.currentload_system | ||
}; | ||
if (_darwin) { | ||
result.currentload = -1; | ||
result.currentload_user = -1; | ||
result.currentload_nice = -1; | ||
result.currentload_system = -1; | ||
exec("ps -cax -o pcpu", function (error, stdout) { | ||
@@ -77,38 +88,49 @@ if (!error) { | ||
if (_linux) { | ||
exec("cat /proc/stat | grep 'cpu '", function (error, stdout) { | ||
if (!error) { | ||
let lines = stdout.toString().split('\n'); | ||
let parts = lines[0].replace(/ +/g, " ").split(' '); | ||
let user = (parts.length >= 2 ? parseInt(parts[1]) : 0); | ||
let nice = (parts.length >= 3 ? parseInt(parts[2]) : 0); | ||
let system = (parts.length >= 4 ? parseInt(parts[3]) : 0); | ||
let idle = (parts.length >= 5 ? parseInt(parts[4]) : 0); | ||
let iowait = (parts.length >= 6 ? parseInt(parts[5]) : 0); | ||
let irq = (parts.length >= 7 ? parseInt(parts[6]) : 0); | ||
let softirq = (parts.length >= 8 ? parseInt(parts[7]) : 0); | ||
let steal = (parts.length >= 9 ? parseInt(parts[8]) : 0); | ||
let guest = (parts.length >= 10 ? parseInt(parts[9]) : 0); | ||
let guest_nice = (parts.length >= 11 ? parseInt(parts[10]) : 0); | ||
let all = user + nice + system + idle + iowait + irq + softirq + steal + guest + guest_nice; | ||
result.currentload = (user + nice + system - _current_cpu.user - _current_cpu.nice - _current_cpu.system) / (all - _current_cpu.all) * 100; | ||
let now = Date.now() - _current_cpu.ms; | ||
if (now >= 1000) { | ||
_current_cpu.ms = Date.now(); | ||
exec("cat /proc/stat | grep 'cpu '", function (error, stdout) { | ||
if (!error) { | ||
let lines = stdout.toString().split('\n'); | ||
let parts = lines[0].replace(/ +/g, " ").split(' '); | ||
let user = (parts.length >= 2 ? parseInt(parts[1]) : 0); | ||
let nice = (parts.length >= 3 ? parseInt(parts[2]) : 0); | ||
let system = (parts.length >= 4 ? parseInt(parts[3]) : 0); | ||
let idle = (parts.length >= 5 ? parseInt(parts[4]) : 0); | ||
let iowait = (parts.length >= 6 ? parseInt(parts[5]) : 0); | ||
let irq = (parts.length >= 7 ? parseInt(parts[6]) : 0); | ||
let softirq = (parts.length >= 8 ? parseInt(parts[7]) : 0); | ||
let steal = (parts.length >= 9 ? parseInt(parts[8]) : 0); | ||
let guest = (parts.length >= 10 ? parseInt(parts[9]) : 0); | ||
let guest_nice = (parts.length >= 11 ? parseInt(parts[10]) : 0); | ||
let all = user + nice + system + idle + iowait + irq + softirq + steal + guest + guest_nice; | ||
result.currentload = (user + nice + system - _current_cpu.user - _current_cpu.nice - _current_cpu.system) / (all - _current_cpu.all) * 100; | ||
result.currentload_user = (user - _current_cpu.user) / (all - _current_cpu.all) * 100; | ||
result.currentload_nice = (nice - _current_cpu.nice) / (all - _current_cpu.all) * 100; | ||
result.currentload_system = (system - _current_cpu.system) / (all - _current_cpu.all) * 100; | ||
_current_cpu = { | ||
user: user, | ||
nice: nice, | ||
system: system, | ||
idle: idle, | ||
iowait: iowait, | ||
irq: irq, | ||
softirq: softirq, | ||
steal: steal, | ||
guest: guest, | ||
guest_nice: guest_nice, | ||
all: all | ||
result.currentload_user = (user - _current_cpu.user) / (all - _current_cpu.all) * 100; | ||
result.currentload_nice = (nice - _current_cpu.nice) / (all - _current_cpu.all) * 100; | ||
result.currentload_system = (system - _current_cpu.system) / (all - _current_cpu.all) * 100; | ||
_current_cpu = { | ||
user: user, | ||
nice: nice, | ||
system: system, | ||
idle: idle, | ||
iowait: iowait, | ||
irq: irq, | ||
softirq: softirq, | ||
steal: steal, | ||
guest: guest, | ||
guest_nice: guest_nice, | ||
all: all, | ||
ms: _current_cpu.ms, | ||
currentload: result.currentload, | ||
currentload_user: result.currentload_user, | ||
currentload_nice: result.currentload_nice, | ||
currentload_system: result.currentload_system | ||
} | ||
} | ||
} | ||
resolve(result); | ||
}); | ||
} else { | ||
resolve(result); | ||
}); | ||
} | ||
} | ||
@@ -115,0 +137,0 @@ }); |
{ | ||
"name": "systeminformation", | ||
"version": "3.8.1", | ||
"version": "3.9.0", | ||
"description": "Simple system and OS information library", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -45,2 +45,3 @@ # systeminformation | ||
- Version 3.9.0: extended networkInterfaces (added MAC address). | ||
- Version 3.8.0: added dockerContainerProcesses (array of processes inside a docker container). | ||
@@ -187,2 +188,3 @@ - Version 3.7.0: extended docker stats. | ||
| - [0].ip6 | X | X | ip6 address | | ||
| - [0].mac | X | X | MAC address | | ||
| - [0].internal | X | X | true if internal interface | | ||
@@ -189,0 +191,0 @@ | si.networkInterfaceDefault(cb) | X | X | get name of default network interface | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
155005
3328
417
20