New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

systeminformation

Package Overview
Dependencies
Maintainers
1
Versions
694
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

systeminformation - npm Package Compare versions

Comparing version 3.19.0 to 3.20.0

1

CHANGELOG.md

@@ -98,2 +98,3 @@ # Changelog

| -------------- | -------------- | -------- |
| 3.20.0 | 2017-06-16 | extend windows support (cpu, cpuCache, cpuCurrentspeed, mem, networkInterfaces, docker) |
| 3.19.0 | 2017-06-12 | OSX temperature now an optional dependency |

@@ -100,0 +101,0 @@ | 3.18.0 | 2017-05-27 | extended `cpu` info (vendor, family, model, stepping, revision, cache, speedmin/max) |

67

lib/cpu.js

@@ -59,6 +59,8 @@ 'use strict';

function getValue(lines, property) {
function getValue(lines, property, separator) {
separator = separator || ':';
property = property.toLowerCase();
for (let i = 0; i < lines.length; i++) {
if (lines[i].toLowerCase().startsWith(property)) {
const parts = lines[i].split(':');
const parts = lines[i].split(separator);
if (parts.length > 1) {

@@ -159,11 +161,32 @@ return parts[1].trim();

if (_windows) {
exec("wmic cpu get name", function (error, stdout) {
exec("wmic cpu get name, description, revision, l2cachesize, l3cachesize, manufacturer, currentclockspeed, maxclockspeed /value", function (error, stdout) {
if (!error) {
let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
let line = (lines && lines[0]) ? lines[0] : '';
result.brand = line.split('@')[0].trim();
result.speed = line.split('@')[1].trim();
result.speed = parseFloat(result.speed.replace(/GHz+/g, ""));
let lines = stdout.split('\r\n');
let name = getValue(lines, 'name', '=') || '';
result.brand = name.split('@')[0].trim();
result.speed = name.split('@')[1].trim();
result.speed = parseFloat(result.speed.replace(/GHz+/g, "").trim()).toFixed(2);
_cpu_speed = result.speed;
result = cpuBrandManufacturer(result);
result.revision = getValue(lines, 'revision', '=');
result.cache.l2 = getValue(lines, 'l2cachesize', '=');
result.cache.l3 = getValue(lines, 'l3cachesize', '=');
if (result.cache.l2) { result.cache.l2 = parseInt(result.cache.l2) * 1024}
if (result.cache.l3) { result.cache.l3 = parseInt(result.cache.l3) * 1024}
result.vendor = getValue(lines, 'manufacturer', '=');
result.speedmax = Math.round(parseFloat(getValue(lines, 'maxclockspeed', '=').replace(/,/g, '.')) / 10.0) / 100;
result.speedmax = result.speedmax ? parseFloat(result.speedmax).toFixed(2) : ''
let description = getValue(lines, 'description', '=').split(' ');
for (let i = 0; i < description.length; i++) {
if (description[i].toLowerCase().startsWith('family') && (i+1) < description.length && description[i+1]) {
result.family = description[i+1]
}
if (description[i].toLowerCase().startsWith('model') && (i+1) < description.length && description[i+1]) {
result.model = description[i+1]
}
if (description[i].toLowerCase().startsWith('stepping') && (i+1) < description.length && description[i+1]) {
result.stepping = description[i+1]
}
}
}

@@ -214,5 +237,5 @@ resolve(result);

return {
min: parseFloat((minFreq / 1000).toFixed(2)),
max: parseFloat((maxFreq / 1000).toFixed(2)),
avg: parseFloat((avgFreq / 1000).toFixed(2))
min: parseFloat(((minFreq + 1) / 1000).toFixed(2)),
max: parseFloat(((maxFreq + 1) / 1000).toFixed(2)),
avg: parseFloat(((avgFreq + 1) / 1000).toFixed(2))
}

@@ -339,5 +362,5 @@ } else {

}
if (callback) { callback(result) }
resolve(result);
}
if (callback) { callback(result) }
resolve(result);
});

@@ -404,7 +427,2 @@ }

process.nextTick(() => {
if (_windows) {
let error = new Error(NOT_SUPPORTED);
if (callback) { callback(NOT_SUPPORTED) }
reject(error);
}

@@ -460,2 +478,15 @@ let result = {};

}
if (_windows) {
exec("wmic cpu get l2cachesize, l3cachesize /value", function (error, stdout) {
if (!error) {
let lines = stdout.split('\r\n');
result.l2 = getValue(lines, 'l2cachesize', '=');
result.l3 = getValue(lines, 'l3cachesize', '=');
if (result.l2) { result.l2 = parseInt(result.l2) * 1024}
if (result.l3) { result.l3 = parseInt(result.l3) * 1024}
}
if (callback) { callback(result) }
resolve(result);
})
}
});

@@ -462,0 +493,0 @@ });

@@ -54,8 +54,2 @@ 'use strict';

process.nextTick(() => {
if (_windows) {
let error = new Error(NOT_SUPPORTED);
if (callback) { callback(NOT_SUPPORTED) }
reject(error);
}
if (!_docker_socket) {

@@ -230,7 +224,2 @@ _docker_socket = new DockerSocket();

process.nextTick(() => {
if (_windows) {
let error = new Error(NOT_SUPPORTED);
if (callback) { callback(NOT_SUPPORTED) }
reject(error);
}
if (containerID) {

@@ -299,7 +288,2 @@

process.nextTick(() => {
if (_windows) {
let error = new Error(NOT_SUPPORTED);
if (callback) { callback(NOT_SUPPORTED) }
reject(error);
}
if (containerID) {

@@ -374,7 +358,2 @@

process.nextTick(() => {
if (_windows) {
let error = new Error(NOT_SUPPORTED);
if (callback) { callback(NOT_SUPPORTED) }
reject(error);
}
dockerContainers(true).then(result => {

@@ -381,0 +360,0 @@ if (result && Object.prototype.toString.call(result) === '[object Array]' && result.length > 0) {

'use strict';
const net = require('net');
const isWin = require('os').type() === 'Windows_NT';
const socketPath = isWin ? '//./pipe/docker_engine' : '/var/run/docker.sock';

@@ -10,3 +12,3 @@ class DockerSocket {

let socket = net.createConnection({path: '/var/run/docker.sock'});
let socket = net.createConnection({path: socketPath});
let alldata = '';

@@ -42,3 +44,3 @@

try {
let socket = net.createConnection({path: '/var/run/docker.sock'});
let socket = net.createConnection({path: socketPath});
let alldata = '';

@@ -77,3 +79,3 @@

try {
let socket = net.createConnection({path: '/var/run/docker.sock'});
let socket = net.createConnection({path: socketPath});
let alldata = '';

@@ -80,0 +82,0 @@

@@ -27,2 +27,16 @@ 'use strict';

function getValue(lines, property, separator) {
separator = separator || ':';
property = property.toLowerCase();
for (let i = 0; i < lines.length; i++) {
if (lines[i].toLowerCase().startsWith(property)) {
const parts = lines[i].split(separator);
if (parts.length > 1) {
return parts[1].trim();
}
}
}
return '';
}
function graphics(callback) {

@@ -256,9 +270,2 @@

process.nextTick(() => {
if (_windows) {
let error = new Error(NOT_SUPPORTED);
if (callback) {
callback(NOT_SUPPORTED)
}
reject(error);
}
let result = {

@@ -309,2 +316,22 @@ controllers: [],

}
if (_windows) {
// https://blogs.technet.microsoft.com/heyscriptingguy/2013/10/03/use-powershell-to-discover-multi-monitor-information/
exec("wmic path win32_VideoController get AdapterCompatibility, AdapterDACType, name, PNPDeviceID, CurrentVerticalResolution, CurrentHorizontalResolution, CurrentNumberOfColors, AdapterRAM, CurrentBitsPerPixel, CurrentRefreshRate, MinRefreshRate, MaxRefreshRate /value", function (error, stdout) {
if (!error) {
let lines = stdout.split('\r\n');
result.controllers.push({});
result.displays.push({});
result.controllers[0].model = getValue(lines, 'name', '=');
result.controllers[0].vendor = getValue(lines, 'AdapterCompatibility', '=');
result.controllers[0].bus = getValue(lines, 'PNPDeviceID', '=').startsWith('PCI') ? 'PCI' : '';
result.controllers[0].vram = getValue(lines, 'AdapterRAM', '=');
result.displays[0].resolutionx = getValue(lines, 'CurrentHorizontalResolution', '=');
result.displays[0].resolutiony = getValue(lines, 'CurrentVerticalResolution', '=');
result.displays[0].depth = getValue(lines, 'CurrentBitsPerPixel', '=');
}
resolve(result);
})
}
});

@@ -311,0 +338,0 @@ });

@@ -85,2 +85,3 @@ 'use strict';

// version date comment
// 3.20.0 2017-06-16 extend windows support (cpu, cpuCache, cpuCurrentspeed, mem, networkInterfaces, docker)
// 3.19.0 2017-06-12 OSX temperature now an optional dependency

@@ -87,0 +88,0 @@ // 3.18.0 2017-05-27 extended `cpu` info (vendor, family, model, stepping, revision, cache, speedmin/max)

@@ -153,4 +153,26 @@ 'use strict';

}
if (_windows) {
let swaptotal = 0;
let swapused = 0;
exec("wmic pagefile get AllocatedBaseSize, CurrentUsage", function (error, stdout) {
if (!error) {
let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
lines.forEach(function (line) {
if (line !== '') {
line = line.trim().split(/\s\s+/);
swaptotal = swaptotal + parseInt(line[0]);
swapused = swapused + parseInt(line[1]);
}
});
}
result.swaptotal = swaptotal * 1024 * 1024;
result.swapused = swapused * 1024 * 1024;
result.swapfree = result.swaptotal - result.swapused;
if (callback) { callback(result) }
resolve(result);
});
}
});
});
};
{
"name": "systeminformation",
"version": "3.19.0",
"version": "3.20.0",
"description": "Simple system and OS information library",

@@ -54,6 +54,3 @@ "license": "MIT",

"node": ">=4.0.0"
},
"optionalDependencies": {
"osx-temperature-sensor": "^1.0.0"
}
}

@@ -26,3 +26,3 @@ # systeminformation

```
var si = require('systeminformation');
const si = require('systeminformation');

@@ -46,3 +46,4 @@ // callback style

- Version 3.19.0: OSX temperature now an optional dependency
- Version 3.20.0: added additional windows support (cpu, cpuCache, cpuCurrentspeed, mem, networkInterfaces, docker)
- Version 3.19.0: OSX temperature now an optional dependency (see comments below in reference!)
- Version 3.18.0: extended `cpu` info (vendor, family, model, stepping, revision, cache, speedmin, speedmax)

@@ -89,261 +90,286 @@ - Version 3.17.0: windows support for some very first functions (work in progress)

### Sections
### Function Reference and OS Support
This library is splitted in several sections:
#### 1. General
1. General
2. System (HW)
3. Operating System
4. CPU
5. Memory
6. File System
7. Network
8. Processes
9. Users
10. Internet
11. Docker
12. GetAll
| Function | Result object | Linux | OSX | Win | Comments |
| --------------- | ----- | ----- | ---- | ------- | -------- |
| si.version() | : string | X | X | X | lib version (no callback/promise) |
| si.time() | {...} | X | X | X | (no callback/promise) |
| | current | X | X | X | local time |
| | uptime | X | X | X | uptime |
### Function Reference and OS Support
#### 2. System (HW)
| Function | Linux | OSX | Win | Comments |
| --------------- | ----- | ---- | ------- | -------- |
| si.version() | X | X | X | library version (no callback/promise) |
| si.time() | X | X | X | time information (no callback/promise) |
| - current | X | X | X | local time |
| - uptime | X | X | X | uptime |
| si.system(cb) | X | X | X | hardware information |
| - manufacturer | X | X | X | e.g. 'MSI' |
| - model | X | X | X | model/product e.g. 'MS-7823' |
| - version | X | X | X | version e.g. '1.0' |
| - serial | X | X | X | serial number |
| - uuid | X | X | X | UUID |
| si.osInfo(cb) | X | X | X | OS information |
| - platform | X | X | X | 'Linux', 'Darwin', 'Windows' |
| - distro | X | X | X | |
| - release | X | X | X | |
| - codename | | X | | |
| - kernel | X | X | X | kernel release - same as os.release() |
| - arch | X | X | X | same as os.arch() |
| - hostname | X | X | X | same as os.hostname() |
| - logofile | X | X | X | e.g. 'apple', 'debian', 'fedora', ... |
| si.versions(cb) | X | X | X | Version information (kernel, ssl, node, ...) |
| si.shell(cb) | X | X | | standard shell |
| si.cpu(cb) | X | X | X | CPU information|
| - manufacturer | X | X | X | e.g. 'Intel(R)' |
| - brand | X | X | X | e.g. 'Core(TM)2 Duo' |
| - speed | X | X | X | in GHz e.g. '3.40' |
| - speedmin | X | X | X | in GHz e.g. '0.80' |
| - speedmax | X | X | X | in GHz e.g. '3.90' |
| - cores | X | X | X | # cores |
| - vendor | X | X | | Vendow ID |
| - family | X | X | | Processor Family |
| - Model | X | X | | Processor Model |
| - stepping | X | X | | Processor Stepping |
| - revision | X | X | | Revision |
| - cache | X | X | | cache in bytes (object) |
| - cache.l1d | X | X | | L1D size |
| - cache.l1i | X | X | | L1I size |
| - cache.l2 | X | X | | L2 size |
| - cache.l3 | X | X | | L3 size |
| si.cpuFlags(cb) | X | X | | CPU flags|
| si.cpuCache(cb) | X | X | | CPU cache sizes |
| - l1d | X | X | | L1D size |
| - l1i | X | X | | L1I size |
| - l2 | X | X | | L2 size |
| - l3 | X | X | | L3 size |
| si.cpuCurrentspeed(cb) | X | X | | current CPU speed (in GHz)|
| - avg | X | X | | avg CPU speed (all cores) |
| - min | X | X | | min CPU speed (all cores) |
| - max | X | X | | max CPU speed (all cores) |
| si.cpuTemperature(cb) | X | X | X | CPU temperature (if sensors is installed) |
| - main | X | X | X | main temperature |
| - cores | X | X | X | array of temperatures |
| - max | X | X | X | max temperature |
| si.mem(cb) | X | X | X | Memory information|
| - total | X | X | X | total memory |
| - free | X | X | X | not used |
| - used | X | X | X | used (incl. buffers/cache) |
| - active | X | X | X | used actively (excl. buffers/cache) |
| - buffcache | X | X | | used by buffers+cache |
| - available | X | X | X | potentially available (total - active) |
| - swaptotal | X | X | | |
| - swapused | X | X | | |
| - swapfree | X | X | | |
| si.battery(cb) | X | X | | battery information |
| - hasbattery | X | X | | indicates presence of battery |
| - ischarging | X | X | | indicates if battery is charging |
| - maxcapacity | X | X | | max capacity of battery |
| - currentcapacity | X | X | | current capacity of battery |
| - percent | X | X | | charging level in percent |
| si.graphics(cb) | X | X | | arrays of graphics controllers and displays |
| - controllers[0].model | X | X | | graphics controller model |
| - controllers[0].vendor | X | X | | e.g. ATI |
| - controllers[0].bus | X | X | | on which bus (e.g. PCIe) |
| - controllers[0].vram | X | X | | VRAM size (in MB) |
| - controllers[0].vramDynamic | X | X | | true if dynamicly allocated ram |
| - displays[0].model | X | X | | Monitor/Display Model |
| - displays[0].main | X | X | | true if main monitor |
| - displays[0].builtin | X | X | | true if built in monitor |
| - displays[0].connection | X | X | | e.g. DisplayPort or HDMI |
| - displays[0].resolutionx | X | X | | pixel horizontal |
| - displays[0].resolutiony | X | X | | pixel vertical |
| - displays[0].depth | X | X | | color depth in bits |
| - displays[0].sizex | X | X | | size in mm horizontal |
| - displays[0].sizey | X | X | | size in mm vertical |
| si.fsSize(cb) | X | X | X | returns array of mounted file systems |
| - [0].fs | X | X | X | name of file system |
| - [0].type | X | X | X | type of file system |
| - [0].size | X | X | X | sizes in Bytes |
| - [0].used | X | X | X | used in Bytes |
| - [0].use | X | X | X | used in % |
| - [0].mount | X | X | X | mount point |
| si.blockDevices(cb) | X | X | X | returns array of disks, partitions,<br>raids and roms |
| - [0].name | X | X | X | name |
| - [0].type | X | X | X | type |
| - [0].fstype | X | X | X | file system type (e.g. ext4) |
| - [0].mount | X | X | X | mount point |
| - [0].size | X | X | X | size in bytes |
| - [0].physical | X | X | X | physical type (HDD, SSD, CD/DVD) |
| - [0].uuid | X | X | X | UUID |
| - [0].label | X | X | X | label |
| - [0].model | X | X | | model |
| - [0].serial | X | | X | serial |
| - [0].removable | X | X | X | serial |
| - [0].protocol | X | X | | protocol (SATA, PCI-Express, ...) |
| si.fsStats(cb) | X | X | | current transfer stats |
| - rx | X | X | | bytes read since startup |
| - wx | X | X | | bytes written since startup |
| - tx | X | X | | total bytes read + written since startup |
| - rx_sec | X | X | | bytes read / second (* see notes) |
| - wx_sec | X | X | | bytes written / second (* see notes) |
| - tx_sec | X | X | | total bytes reads + written / second |
| - ms | X | X | | interval length (for per second values) |
| si.disksIO(cb) | X | X | | current transfer stats |
| - rIO | X | X | | read IOs on all mounted drives |
| - wIO | X | X | | write IOs on all mounted drives |
| - tIO | X | X | | write IOs on all mounted drives |
| - rIO_sec | X | X | | read IO per sec (* see notes) |
| - wIO_sec | X | X | | write IO per sec (* see notes) |
| - tIO_sec | X | X | | total IO per sec (* see notes) |
| - ms | X | X | | interval length (for per second values) |
| si.networkInterfaces(cb) | X | X | | array of network interfaces |
| - [0].iface | X | X | | interface name |
| - [0].ip4 | X | X | | ip4 address |
| - [0].ip6 | X | X | | ip6 address |
| - [0].mac | X | X | | MAC address |
| - [0].internal | X | X | | true if internal interface |
| si.networkInterfaceDefault(cb) | X | X | | get name of default network interface |
| si.networkStats(iface,cb) | X | X | | current network stats of given interface<br>iface parameter is optional<br>defaults to first external network interface|
| - iface | X | X | | interface |
| - operstate | X | X | | up / down |
| - rx | X | X | | received bytes overall |
| - tx | X | X | | transferred bytes overall|
| - rx_sec | X | X | | received bytes / second (* see notes) |
| - tx_sec | X | X | | transferred bytes per second (* see notes) |
| - ms | X | X | | interval length (for per second values) |
| si.networkConnections(cb) | X | X | | current network network connections<br>returns an array of all connections|
| - [0].protocol | X | X | | tcp or udp |
| - [0].localaddress | X | X | | local address |
| - [0].localport | X | X | | local port |
| - [0].peeraddress | X | X | | peer address |
| - [0].peerport | X | X | | peer port |
| - [0].state | X | X | | like ESTABLISHED, TIME_WAIT, ... |
| si.currentLoad(cb) | X | X | | CPU-Load |
| - avgload | X | X | | average load |
| - currentload | X | X | | CPU-Load in % |
| - currentload_user | X | X | | CPU-Load User in % |
| - currentload_nice | X | X | | CPU-Load Nice in % |
| - currentload_system | X | X | | CPU-Load System in % |
| - currentload_irq | X | X | | CPU-Load System in % |
| - cpus[] | X | X | | current loads per CPU in % |
| si.fullLoad(cb) | X | X | | CPU-full load since bootup in % |
| si.services('mysql, apache2', cb) | X | X | | pass comma separated string of services |
| - [0].name | X | X | | name of service |
| - [0].running | X | X | | true / false |
| - [0].pcpu | X | X | | process % CPU |
| - [0].pmem | X | X | | process % MEM |
| si.processes(cb) | X | X | | # running processes |
| - all | X | X | | # of all processes |
| - running | X | X | | # of all processes running |
| - blocked | X | X | | # of all processes blocked |
| - sleeping | X | X | | # of all processes sleeping |
| - list[] | X | X | | list of all processes incl. details |
| - ...[0].pid | X | X | | process PID |
| - ...[0].pcpu | X | X | | process % CPU usage |
| - ...[0].pcpuu | X | | | process % CPU usage (user) |
| - ...[0].pcpus | X | | | process % CPU usage (system) |
| - ...[0].pmem | X | X | | process memory % |
| - ...[0].priority | X | X | | process priotity |
| - ...[0].mem_vsz | X | X | | process virtual memory size |
| - ...[0].mem_rss | X | X | | process mem resident set size |
| - ...[0].nice | X | X | | process nice value |
| - ...[0].started | X | X | | process start time |
| - ...[0].state | X | X | | process state (e.g. sleeping) |
| - ...[0].tty | X | X | | tty from which process was started |
| - ...[0].user | X | X | | user who started process |
| - ...[0].command | X | X | | process starting command |
| si.processLoad('apache2',cb) | X | X | | detailed information about given process |
| - proc | X | X | | process name |
| - pid | X | X | | PID |
| - cpu | X | X | | process % CPU |
| - mem | X | X | | process % MEM |
| si.users(cb) | X | X | | array of users online |
| - [0].user | X | X | | user name |
| - [0].tty | X | X | | terminal |
| - [0].date | X | X | | login date |
| - [0].time | X | X | | login time |
| - [0].ip | X | X | | ip address (remote login) |
| - [0].command | X | X | | last command or shell |
| si.inetChecksite(url, cb) | X | X | | response-time (ms) to fetch given URL |
| - url | X | X | | given url |
| - ok | X | X | | status code OK (2xx, 3xx) |
| - status | X | X | | status code |
| - ms | X | X | | response time in ms |
| si.inetLatency(host, cb) | X | X | | response-time (ms) to external resource<br>host parameter is optional (default 8.8.8.8)|
| si.dockerContainers(all, cb) | X | X | | returns array of active/all docker containers |
| - [0].id | X | X | | ID of container |
| - [0].name | X | X | | name of container |
| - [0].image | X | X | | name of image |
| - [0].imageID | X | X | | ID of image |
| - [0].command | X | X | | command |
| - [0].created | X | X | | creation time |
| - [0].state | X | X | | created, running, exited |
| - [0].ports | X | X | | array of ports |
| - [0].mounts | X | X | | array of mounts |
| si.dockerContainerStats(id, cb) | X | X | | statistics for a specific container |
| - id | X | X | | Container ID |
| - mem_usage | X | X | | memory usage in bytes |
| - mem_limit | X | X | | memory limit (max mem) in bytes |
| - mem_percent | X | X | | memory usage in percent |
| - cpu_percent | X | X | | cpu usage in percent |
| - pids | X | X | | number of processes |
| - netIO.rx | X | X | | received bytes via network |
| - netIO.wx | X | X | | sent bytes via network |
| - blockIO.r | X | X | | bytes read from BlockIO |
| - blockIO.w | X | X | | bytes written to BlockIO |
| - cpu_stats | X | X | | detailed cpu stats |
| - percpu_stats | X | X | | detailed per cpu stats |
| - memory_stats | X | X | | detailed memory stats |
| - networks | X | X | | detailed network stats per interface |
| si.dockerContainerProcesses(id, cb) | X | X | | array of processes inside a container |
| - [0].pid_host | X | X | | process ID (host) |
| - [0].ppid | X | X | | parent process ID |
| - [0].pgid | X | X | | process group ID |
| - [0].user | X | X | | effective user name |
| - [0].ruser | X | X | | real user name |
| - [0].group | X | X | | effective group name |
| - [0].rgroup | X | X | | real group name |
| - [0].stat | X | X | | process state |
| - [0].time | X | X | | accumulated CPU time |
| - [0].elapsed | X | X | | elapsed running time |
| - [0].nice | X | X | | nice value |
| - [0].rss | X | X | | resident set size |
| - [0].vsz | X | X | | virtual size in Kbytes |
| - [0].command | X | X | | command and arguments |
| si.dockerAll(cb) | X | X | | list of all containers including their stats<br>and processes in one single array |
| si.getStaticData(cb) | X | X | | all static data at once |
| si.getDynamicData(srv,iface,cb) | X | X | | all dynamic data at once |
| si.getAllData(srv,iface,cb) | X | X | | all data at once |
| Function | Result object | Linux | OSX | Win | Comments |
| --------------- | ----- | ----- | ---- | ------- | -------- |
| si.system(cb) | {...} | X | X | X | hardware information |
| | manufacturer | X | X | X | e.g. 'MSI' |
| | model | X | X | X | model/product e.g. 'MS-7823' |
| | version | X | X | X | version e.g. '1.0' |
| | serial | X | X | X | serial number |
| | uuid | X | X | X | UUID |
#### 3. CPU, Memory, Battery, Graphics
| Function | Result object | Linux | OSX | Win | Comments |
| --------------- | ----- | ----- | ---- | ------- | -------- |
| si.cpu(cb) | {...} | X | X | X | CPU information|
| | manufacturer | X | X | X | e.g. 'Intel(R)' |
| | brand | X | X | X | e.g. 'Core(TM)2 Duo' |
| | speed | X | X | X | in GHz e.g. '3.40' |
| | speedmin | X | X | X | in GHz e.g. '0.80' |
| | speedmax | X | X | X | in GHz e.g. '3.90' |
| | cores | X | X | X | # cores |
| | vendor | X | X | X | Vendow ID |
| | family | X | X | X | Processor Family |
| | Model | X | X | X | Processor Model |
| | stepping | X | X | X | Processor Stepping |
| | revision | X | X | X | Revision |
| | cache | X | X | X | cache in bytes (object) |
| | cache.l1d | X | X | | L1D size |
| | cache.l1i | X | X | | L1I size |
| | cache.l2 | X | X | X | L2 size |
| | cache.l3 | X | X | X | L3 size |
| si.cpuFlags(cb) | : string | X | X | | CPU flags|
| si.cpuCache(cb) | {...} | X | X | X | CPU cache sizes |
| | l1d | X | X | | L1D size |
| | l1i | X | X | | L1I size |
| | l2 | X | X | X | L2 size |
| | l3 | X | X | X | L3 size |
| si.cpuCurrentspeed(cb) | {...} | X | X | X | current CPU speed (in GHz)|
| | avg | X | X | X | avg CPU speed (all cores) |
| | min | X | X | X | min CPU speed (all cores) |
| | max | X | X | X | max CPU speed (all cores) |
| si.cpuTemperature(cb) | {...} | X | X* | X | CPU temperature (if supported) |
| | main | X | X | X | main temperature |
| | cores | X | X | X | array of temperatures |
| | max | X | X | X | max temperature |
| si.mem(cb) | {...} | X | X | X | Memory information|
| | total | X | X | X | total memory |
| | free | X | X | X | not used |
| | used | X | X | X | used (incl. buffers/cache) |
| | active | X | X | X | used actively (excl. buffers/cache) |
| | buffcache | X | X | | used by buffers+cache |
| | available | X | X | X | potentially available (total - active) |
| | swaptotal | X | X | | |
| | swapused | X | X | | |
| | swapfree | X | X | | |
| si.battery(cb) | {...} | X | X | | battery information |
| | hasbattery | X | X | | indicates presence of battery |
| | ischarging | X | X | | indicates if battery is charging |
| | maxcapacity | X | X | | max capacity of battery |
| | currentcapacity | X | X | | current capacity of battery |
| | percent | X | X | | charging level in percent |
| si.graphics(cb) | {...} | X | X | | arrays of graphics controllers and displays |
| | controllers[0].model | X | X | X | graphics controller model |
| | controllers[0].vendor | X | X | X | e.g. ATI |
| | controllers[0].bus | X | X | X| on which bus (e.g. PCIe) |
| | controllers[0].vram | X | X | X | VRAM size (in MB) |
| | controllers[0].vramDynamic | X | X | | true if dynamicly allocated ram |
| | displays[0].model | X | X | | Monitor/Display Model |
| | displays[0].main | X | X | | true if main monitor |
| | displays[0].builtin | X | X | | true if built in monitor |
| | displays[0].connection | X | X | | e.g. DisplayPort or HDMI |
| | displays[0].resolutionx | X | X | X | pixel horizontal |
| | displays[0].resolutiony | X | X | X | pixel vertical |
| | displays[0].depth | X | X | X | color depth in bits |
| | displays[0].sizex | X | X | | size in mm horizontal |
| | displays[0].sizey | X | X | | size in mm vertical |
#### 4. Operating System
| Function | Result object | Linux | OSX | Win | Comments |
| --------------- | ----- | ----- | ---- | ------- | -------- |
| si.osInfo(cb) | {...} | X | X | X | OS information |
| | platform | X | X | X | 'Linux', 'Darwin', 'Windows' |
| | distro | X | X | X | |
| | release | X | X | X | |
| | codename | | X | | |
| | kernel | X | X | X | kernel release - same as os.release() |
| | arch | X | X | X | same as os.arch() |
| | hostname | X | X | X | same as os.hostname() |
| | logofile | X | X | X | e.g. 'apple', 'debian', 'fedora', ... |
| si.versions(cb) | {...} | X | X | X | Version information (kernel, ssl, node, ...) |
| si.shell(cb) | : string | X | X | | standard shell |
| si.users(cb) | [{...}] | X | X | | array of users online |
| | [0].user | X | X | | user name |
| | [0].tty | X | X | | terminal |
| | [0].date | X | X | | login date |
| | [0].time | X | X | | login time |
| | [0].ip | X | X | | ip address (remote login) |
| | [0].command | X | X | | last command or shell |
#### 5. File System
| Function | Result object | Linux | OSX | Win | Comments |
| --------------- | ----- | ----- | ---- | ------- | -------- |
| si.fsSize(cb) | [{...}] | X | X | X | returns array of mounted file systems |
| | [0].fs | X | X | X | name of file system |
| | [0].type | X | X | X | type of file system |
| | [0].size | X | X | X | sizes in Bytes |
| | [0].used | X | X | X | used in Bytes |
| | [0].use | X | X | X | used in % |
| | [0].mount | X | X | X | mount point |
| si.blockDevices(cb) | [{...}] | X | X | X | returns array of disks, partitions,<br>raids and roms |
| | [0].name | X | X | X | name |
| | [0].type | X | X | X | type |
| | [0].fstype | X | X | X | file system type (e.g. ext4) |
| | [0].mount | X | X | X | mount point |
| | [0].size | X | X | X | size in bytes |
| | [0].physical | X | X | X | physical type (HDD, SSD, CD/DVD) |
| | [0].uuid | X | X | X | UUID |
| | [0].label | X | X | X | label |
| | [0].model | X | X | | model |
| | [0].serial | X | | X | serial |
| | [0].removable | X | X | X | serial |
| | [0].protocol | X | X | | protocol (SATA, PCI-Express, ...) |
| si.fsStats(cb) | {...} | X | X | | current transfer stats |
| | rx | X | X | | bytes read since startup |
| | wx | X | X | | bytes written since startup |
| | tx | X | X | | total bytes read + written since startup |
| | rx_sec | X | X | | bytes read / second (* see notes) |
| | wx_sec | X | X | | bytes written / second (* see notes) |
| | tx_sec | X | X | | total bytes reads + written / second |
| | ms | X | X | | interval length (for per second values) |
| si.disksIO(cb) | {...} | X | X | | current transfer stats |
| | rIO | X | X | | read IOs on all mounted drives |
| | wIO | X | X | | write IOs on all mounted drives |
| | tIO | X | X | | write IOs on all mounted drives |
| | rIO_sec | X | X | | read IO per sec (* see notes) |
| | wIO_sec | X | X | | write IO per sec (* see notes) |
| | tIO_sec | X | X | | total IO per sec (* see notes) |
| | ms | X | X | | interval length (for per second values) |
#### 6. Network related functions
| Function | Result object | Linux | OSX | Win | Comments |
| --------------- | ----- | ----- | ---- | ------- | -------- |
| si.networkInterfaces(cb) | [{...}] | X | X | X | array of network interfaces |
| | [0].iface | X | X | X | interface name |
| | [0].ip4 | X | X | X | ip4 address |
| | [0].ip6 | X | X | X | ip6 address |
| | [0].mac | X | X | X | MAC address |
| | [0].internal | X | X | X | true if internal interface |
| si.networkInterfaceDefault(cb) | : string | X | X | | get name of default network interface |
| si.networkStats(iface,cb) | {...} | X | X | | current network stats of given interface<br>iface parameter is optional<br>defaults to first external network interface|
| | iface | X | X | | interface |
| | operstate | X | X | | up / down |
| | rx | X | X | | received bytes overall |
| | tx | X | X | | transferred bytes overall|
| | rx_sec | X | X | | received bytes / second (* see notes) |
| | tx_sec | X | X | | transferred bytes per second (* see notes) |
| | ms | X | X | | interval length (for per second values) |
| si.networkConnections(cb) | [{...}] | X | X | | current network network connections<br>returns an array of all connections|
| | [0].protocol | X | X | | tcp or udp |
| | [0].localaddress | X | X | | local address |
| | [0].localport | X | X | | local port |
| | [0].peeraddress | X | X | | peer address |
| | [0].peerport | X | X | | peer port |
| | [0].state | X | X | | like ESTABLISHED, TIME_WAIT, ... |
| si.inetChecksite(url, cb) | {...} | X | X | | response-time (ms) to fetch given URL |
| | url | X | X | | given url |
| | ok | X | X | | status code OK (2xx, 3xx) |
| | status | X | X | | status code |
| | ms | X | X | | response time in ms |
| si.inetLatency(host, cb) | | X | X | | response-time (ms) to external resource<br>host parameter is optional (default 8.8.8.8)|
#### 7. Current Load, Processes & Services
| Function | Result object | Linux | OSX | Win | Comments |
| --------------- | ----- | ----- | ---- | ------- | -------- |
| si.currentLoad(cb) | {...} | X | X | | CPU-Load |
| | avgload | X | X | | average load |
| | currentload | X | X | | CPU-Load in % |
| | currentload_user | X | X | | CPU-Load User in % |
| | currentload_nice | X | X | | CPU-Load Nice in % |
| | currentload_system | X | X | | CPU-Load System in % |
| | currentload_irq | X | X | | CPU-Load System in % |
| | cpus[] | X | X | | current loads per CPU in % |
| si.fullLoad(cb) | : integer | X | X | | CPU-full load since bootup in % |
| si.processes(cb) | {...} | X | X | | # running processes |
| | all | X | X | | # of all processes |
| | running | X | X | | # of all processes running |
| | blocked | X | X | | # of all processes blocked |
| | sleeping | X | X | | # of all processes sleeping |
| | list[] | X | X | | list of all processes incl. details |
| | ...[0].pid | X | X | | process PID |
| | ...[0].pcpu | X | X | | process % CPU usage |
| | ...[0].pcpuu | X | | | process % CPU usage (user) |
| | ...[0].pcpus | X | | | process % CPU usage (system) |
| | ...[0].pmem | X | X | | process memory % |
| | ...[0].priority | X | X | | process priotity |
| | ...[0].mem_vsz | X | X | | process virtual memory size |
| | ...[0].mem_rss | X | X | | process mem resident set size |
| | ...[0].nice | X | X | | process nice value |
| | ...[0].started | X | X | | process start time |
| | ...[0].state | X | X | | process state (e.g. sleeping) |
| | ...[0].tty | X | X | | tty from which process was started |
| | ...[0].user | X | X | | user who started process |
| | ...[0].command | X | X | | process starting command |
| si.processLoad('apache2',cb) | {...} | X | X | | detailed information about given process |
| | proc | X | X | | process name |
| | pid | X | X | | PID |
| | cpu | X | X | | process % CPU |
| | mem | X | X | | process % MEM |
| si.services('mysql, apache2', cb) | [{...}] | X | X | | pass comma separated string of services |
| | [0].name | X | X | | name of service |
| | [0].running | X | X | | true / false |
| | [0].pcpu | X | X | | process % CPU |
| | [0].pmem | X | X | | process % MEM |
#### 8. Docker
| Function | Result object | Linux | OSX | Win | Comments |
| --------------- | ----- | ----- | ---- | ------- | -------- |
| si.dockerContainers(all, cb) | [{...}] | X | X | X | returns array of active/all docker containers |
| | [0].id | X | X | X | ID of container |
| | [0].name | X | X | X | name of container |
| | [0].image | X | X | X | name of image |
| | [0].imageID | X | X | X | ID of image |
| | [0].command | X | X | X | command |
| | [0].created | X | X | X | creation time |
| | [0].state | X | X | X | created, running, exited |
| | [0].ports | X | X | X | array of ports |
| | [0].mounts | X | X | X | array of mounts |
| si.dockerContainerStats(id, cb) | {...} | X | X | X | statistics for a specific container |
| | id | X | X | X | Container ID |
| | mem_usage | X | X | X | memory usage in bytes |
| | mem_limit | X | X | X | memory limit (max mem) in bytes |
| | mem_percent | X | X | X | memory usage in percent |
| | cpu_percent | X | X | X | cpu usage in percent |
| | pids | X | X | X | number of processes |
| | netIO.rx | X | X | X | received bytes via network |
| | netIO.wx | X | X | X | sent bytes via network |
| | blockIO.r | X | X | X | bytes read from BlockIO |
| | blockIO.w | X | X | X | bytes written to BlockIO |
| | cpu_stats | X | X | X | detailed cpu stats |
| | percpu_stats | X | X | X | detailed per cpu stats |
| | memory_stats | X | X | X | detailed memory stats |
| | networks | X | X | X | detailed network stats per interface |
| si.dockerContainerProcesses(id, cb) | [{...}] | X | X | X | array of processes inside a container |
| | [0].pid_host | X | X | X | process ID (host) |
| | [0].ppid | X | X | X | parent process ID |
| | [0].pgid | X | X | X | process group ID |
| | [0].user | X | X | X | effective user name |
| | [0].ruser | X | X | X | real user name |
| | [0].group | X | X | X | effective group name |
| | [0].rgroup | X | X | X | real group name |
| | [0].stat | X | X | X | process state |
| | [0].time | X | X | X | accumulated CPU time |
| | [0].elapsed | X | X | X | elapsed running time |
| | [0].nice | X | X | X | nice value |
| | [0].rss | X | X | X | resident set size |
| | [0].vsz | X | X | X | virtual size in Kbytes |
| | [0].command | X | X | X | command and arguments |
| si.dockerAll(cb) | {...} | X | X | X | list of all containers including their stats<br>and processes in one single array |
#### 9. "Get All at once" - functions
| Function | Result object | Linux | OSX | Win | Comments |
| --------------- | ----- | ----- | ---- | ------- | -------- |
| si.getStaticData(cb) | {...} | X | X | | all static data at once |
| si.getDynamicData(srv,iface,cb) | {...} | X | X | | all dynamic data at once |
| si.getAllData(srv,iface,cb) | {...} | X | X | | all data at once |
### cb: Asynchronous Function Calls (callback)

@@ -387,3 +413,31 @@

```
### About Temperature
#### OSX
Due to some difficulties in NPM with `optionalDependencies` I unfortunately
was getting unexpected warnings on other platforms. So I decided to drop temperature
measurement for OSX - or more specific the automatic installation of the needed dependency.
But if you need to detect OSX temperature just run the following additional
installation command:
```bash
$ npm install osx-temperature-sensor --save
```
`systeminformation` will then detect this additional library and return the temperature when calling systeminformations standard function `cpuTemperature()`
#### Windows
`wmic` - which is used to determine the temperature sometimes needs to be run with admin
privileges. So if you do not get any temperature value, try to run it again with according
privileges. If you still do not get any values, your system might not support this feature.
In some cases we also discovered that `wmic` returned incorrect values.
#### Linux
In some cases you need to install the linux `sensors` package to be able to measure temperature
e.g. on DEBIAN based systems by running `sudo apt-get install lm-sensors`
### *: Additional Notes

@@ -425,3 +479,3 @@

- Massimiliano Marcon [mmarcon](https://github.com/mmarcon) - for his work on [smc-code][smc-code-url]
- Massimiliano Marcon [mmarcon](https://github.com/mmarcon) for his work on [smc-code][smc-code-url]
- Sébastien Lavoie [lavoiesl](https://github.com/lavoiesl) for his work on [osx-cpu-temp][osx-cpu-temp-url] code.

@@ -428,0 +482,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc