diff --git a/CHANGELOG.md b/CHANGELOG.md
index c864d4b..8e9f765 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -95,6 +95,7 @@ Other changes
| 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 |
| 3.18.0 | 2017-05-27 | extended `cpu` info (vendor, family, model, stepping, revision, cache, speedmin/max) |
| 3.17.3 | 2017-04-29 | minor fix (blockDevices data array, Windows) |
diff --git a/README.md b/README.md
index d4b7010..a4892a6 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ $ npm install systeminformation --save
All functions (except `version` and `time`) are implemented as asynchronous functions. Here a small example how to use them:
```
-var si = require('systeminformation');
+const si = require('systeminformation');
// callback style
si.cpu(function(data) {
@@ -42,7 +42,8 @@ si.cpu()
### Latest Activity
-- 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)
- Version 3.17.0: windows support for some very first functions (work in progress)
- Version 3.16.0: `blockDevices`: added removable attribute
@@ -84,264 +85,289 @@ I also created a little command line tool called [mmon][mmon-github-url] (micro
## Reference
-### Sections
-
-This library is splitted in several sections:
-
-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 Reference and OS Support
-| 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,
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
iface parameter is optional
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
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
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
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 |
+#### 1. General
+
+| 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 |
+
+#### 2. System (HW)
+
+| 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,
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
iface parameter is optional
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
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
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
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)
@@ -381,6 +407,34 @@ si.networkStats('eth1')
.catch(error => console.error(error));
```
+### 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
@@ -418,7 +472,7 @@ Written by Sebastian Hildebrandt [sebhildebrandt](https://github.com/sebhildebra
OSX Temperature: Credits here are going to:
-- 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.
## Copyright Information
diff --git a/lib/cpu.js b/lib/cpu.js
index 9c19ba6..7787f91 100644
--- a/lib/cpu.js
+++ b/lib/cpu.js
@@ -56,10 +56,12 @@ function cpuBrandManufacturer(res) {
return res;
}
-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) {
return parts[1].trim();
}
@@ -155,15 +157,36 @@ function getCpu() {
})
}
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]
+ }
+ }
}
resolve(result);
})
@@ -209,9 +232,9 @@ function getCpuCurrentSpeedSync() {
}
avgFreq = avgFreq / cpus.length;
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))
}
} else {
return {
@@ -333,9 +356,9 @@ function cpuTemperature(callback) {
if (result.cores.length) {
result.main = sum / result.cores.length;
}
- if (callback) { callback(result) }
- resolve(result);
}
+ if (callback) { callback(result) }
+ resolve(result);
});
}
});
@@ -397,11 +420,6 @@ function cpuCache(callback) {
return new Promise((resolve, reject) => {
process.nextTick(() => {
- if (_windows) {
- let error = new Error(NOT_SUPPORTED);
- if (callback) { callback(NOT_SUPPORTED) }
- reject(error);
- }
let result = {};
if (_linux) {
@@ -452,6 +470,19 @@ function cpuCache(callback) {
resolve(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);
+ })
+ }
});
});
}
diff --git a/lib/docker.js b/lib/docker.js
index c104f87..b89e094 100644
--- a/lib/docker.js
+++ b/lib/docker.js
@@ -51,12 +51,6 @@ function dockerContainers(all, callback) {
let result = [];
return new Promise((resolve, reject) => {
process.nextTick(() => {
- if (_windows) {
- let error = new Error(NOT_SUPPORTED);
- if (callback) { callback(NOT_SUPPORTED) }
- reject(error);
- }
-
if (!_docker_socket) {
_docker_socket = new DockerSocket();
}
@@ -226,11 +220,6 @@ function dockerContainerStats(containerID, callback) {
};
return new Promise((resolve, reject) => {
process.nextTick(() => {
- if (_windows) {
- let error = new Error(NOT_SUPPORTED);
- if (callback) { callback(NOT_SUPPORTED) }
- reject(error);
- }
if (containerID) {
if (!_docker_socket) {
@@ -294,11 +283,6 @@ function dockerContainerProcesses(containerID, callback) {
let result = [];
return new Promise((resolve, reject) => {
process.nextTick(() => {
- if (_windows) {
- let error = new Error(NOT_SUPPORTED);
- if (callback) { callback(NOT_SUPPORTED) }
- reject(error);
- }
if (containerID) {
if (!_docker_socket) {
@@ -368,11 +352,6 @@ exports.dockerContainerProcesses = dockerContainerProcesses;
function dockerAll(callback) {
return new Promise((resolve, reject) => {
process.nextTick(() => {
- if (_windows) {
- let error = new Error(NOT_SUPPORTED);
- if (callback) { callback(NOT_SUPPORTED) }
- reject(error);
- }
dockerContainers(true).then(result => {
if (result && Object.prototype.toString.call(result) === '[object Array]' && result.length > 0) {
let l = result.length;
diff --git a/lib/dockerSocket.js b/lib/dockerSocket.js
index 53f784a..459ee12 100644
--- a/lib/dockerSocket.js
+++ b/lib/dockerSocket.js
@@ -1,13 +1,15 @@
'use strict';
const net = require('net');
+const isWin = require('os').type() === 'Windows_NT';
+const socketPath = isWin ? '//./pipe/docker_engine' : '/var/run/docker.sock';
class DockerSocket {
listContainers(all, callback) {
try {
- let socket = net.createConnection({path: '/var/run/docker.sock'});
+ let socket = net.createConnection({path: socketPath});
let alldata = '';
socket.on("connect", () => {
@@ -38,7 +40,7 @@ class DockerSocket {
id = id || '';
if (id) {
try {
- let socket = net.createConnection({path: '/var/run/docker.sock'});
+ let socket = net.createConnection({path: socketPath});
let alldata = '';
socket.on("connect", () => {
@@ -72,7 +74,7 @@ class DockerSocket {
id = id || '';
if (id) {
try {
- let socket = net.createConnection({path: '/var/run/docker.sock'});
+ let socket = net.createConnection({path: socketPath});
let alldata = '';
socket.on("connect", () => {
diff --git a/lib/graphics.js b/lib/graphics.js
index 3ee111e..c236cc5 100644
--- a/lib/graphics.js
+++ b/lib/graphics.js
@@ -24,6 +24,20 @@ const _darwin = (_platform === 'Darwin');
const _windows = (_platform === 'Windows_NT');
const NOT_SUPPORTED = 'not supported';
+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) {
function parseLinesDarwin(lines) {
@@ -252,13 +266,6 @@ function graphics(callback) {
// function starts here
return new Promise((resolve, reject) => {
process.nextTick(() => {
- if (_windows) {
- let error = new Error(NOT_SUPPORTED);
- if (callback) {
- callback(NOT_SUPPORTED)
- }
- reject(error);
- }
let result = {
controllers: [],
displays: []
@@ -304,6 +311,26 @@ function graphics(callback) {
})
})
}
+ 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);
+ })
+ }
+
});
});
}
diff --git a/lib/index.js b/lib/index.js
index 8ba8ab1..6f6ea39 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -82,6 +82,7 @@
// --------------------------------
//
// 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
// 3.18.0 2017-05-27 extended `cpu` info (vendor, family, model, stepping, revision, cache, speedmin/max)
// 3.17.3 2017-04-29 minor fix (blockDevices data array, Windows)
diff --git a/lib/memory.js b/lib/memory.js
index 7d01d1a..1f583c3 100644
--- a/lib/memory.js
+++ b/lib/memory.js
@@ -150,6 +150,28 @@ module.exports = function (callback) {
});
});
}
+ 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);
+ });
+ }
});
});
};
diff --git a/package.json b/package.json
index 7047f4c..9d8d4fb 100644
--- a/package.json
+++ b/package.json
@@ -51,8 +51,5 @@
],
"engines": {
"node": ">=4.0.0"
- },
- "optionalDependencies": {
- "osx-temperature-sensor": "^1.0.0"
}
}