systeminformation

This is amazing. Started as a small project just for myself, it now has > 9,000 lines of code, > 300 versions published, > 1 mio downloads per month, > 10 mio downloads overall. Thank you to all who contributed to this project!

New Version 4.0

This next major version release 4.0 comes with several optimizations and changes:

Core concept

Node.js comes with some basic OS information, but I always wanted a little more. So I came up to write this little library. This library is still work in progress. It is supposed to be used as a backend/server-side library (will definilely not work within a browser). It requires node.js version 4.0 and above.

I was able to test it on several Debian, Raspbian, Ubuntu distributions as well as macOS (Mavericks, Yosemite, El Captain, Sierra, High Sierra, Mojave) and some Windows 7, Windows 10, FreeBSD, OpenBSD, NetBSD and SunOS machines. Not all functions are supported on all operating systems. Have a look at the function reference in the docs to get further details.

If you have comments, suggestions & reports, please feel free to contact me!

I also created a nice little command line tool called mmon (micro-monitor) for Linux and macOS, also available via github and npm

Reference

Function Reference and OS Support

1. General

Function

Result object

Linux

BSD

Mac

Win

Sun

Comments

si.version()

: string

X

X

X

X

X

lib version (no callback/promise)

si.time()

{...}

X

X

X

X

X

(no callback/promise)

current

X

X

X

X

X

local (server) time

uptime

X

X

X

X

X

uptime in number of seconds

timezone

X

X

X

X

X

e.g. GMT+0200

timezoneName

X

X

X

X

X

e.g. CEST

2. System (HW)

Function

Result object

Linux

BSD

Mac

Win

Sun

Comments

si.system(cb)

{...}

X

X

X

X

hardware information

manufacturer

X

X

X

X

e.g. 'MSI'

model

X

X

X

X

model/product e.g. 'MS-7823'

version

X

X

X

X

version e.g. '1.0'

serial

X

X

X

X

serial number

uuid

X

X

X

X

UUID

sku

X

X

X

X

SKU number

si.bios(cb)

{...}

X

X

X

X

bios information

vendor

X

X

X

X

e.g. 'AMI'

version

X

X

X

version

releaseDate

X

X

X

release date

revision

X

X

X

revision

si.baseboard(cb)

{...}

X

X

X

X

baseboard information

manufacturer

X

X

X

X

e.g. 'ASUS'

model

X

X

X

X

model / product name

version

X

X

X

X

version

serial

X

X

X

X

serial number

assetTag

X

X

X

X

asset tag

si.chassis(cb)

{...}

X

X

X

X

chassis information

manufacturer

X

X

X

X

e.g. 'MSI'

model

X

X

X

X

model / product name

type

X

X

X

X

model / product name

version

X

X

X

X

version

serial

X

X

X

X

serial number

assetTag

X

X

X

X

asset tag

sku

X

SKU number

3. CPU

Function

Result object

Linux

BSD

Mac

Win

Sun

Comments

si.cpu(cb)

{...}

X

X

X

X

CPU information

manufacturer

X

X

X

X

e.g. 'Intel(R)'

brand

X

X

X

X

e.g. 'Core(TM)2 Duo'

speed

X

X

X

X

in GHz e.g. '3.40'

speedmin

X

X

X

in GHz e.g. '0.80'

speedmax

X

X

X

X

in GHz e.g. '3.90'

governor

X

e.g. 'powersave'

cores

X

X

X

X

# cores

physicalCores

X

X

X

X

# physical cores

processors

X

X

X

X

# processors

socket

X

X

X

socket type e.g. "LGA1356"

vendor

X

X

X

X

vendor ID

family

X

X

X

X

processor family

model

X

X

X

X

processor model

stepping

X

X

X

X

processor stepping

revision

X

X

X

revision

voltage

X

voltage

cache

X

X

X

X

cache in bytes (object)

cache.l1d

X

X

X

X

L1D (data) size

cache.l1i

X

X

X

X

L1I (instruction) size

cache.l2

X

X

X

X

L2 size

cache.l3

X

X

X

X

L3 size

si.cpuFlags(cb)

: string

X

X

X

X

CPU flags

si.cpuCache(cb)

{...}

X

X

X

X

CPU cache sizes

l1d

X

X

X

X

L1D size

l1i

X

X

X

X

L1I size

l2

X

X

X

X

L2 size

l3

X

X

X

X

L3 size

si.cpuCurrentspeed(cb)

{...}

X

X

X

X

X

current CPU speed (in GHz)

avg

X

X

X

X

X

avg CPU speed (all cores)

min

X

X

X

X

X

min CPU speed (all cores)

max

X

X

X

X

X

max CPU speed (all cores)

cores

X

X

X

X

X

CPU speed per core (array)

si.cpuTemperature(cb)

{...}

X

X

X*

X

CPU temperature (if supported)

main

X

X

X

X

main temperature (avg)

cores

X

X

X

X

array of temperatures

max

X

X

X

X

max temperature

4. Memory

Function

Result object

Linux

BSD

Mac

Win

Sun

Comments

si.mem(cb)

{...}

X

X

X

X

X

Memory information (in bytes)

total

X

X

X

X

X

total memory in bytes

free

X

X

X

X

X

not used in bytes

used

X

X

X

X

X

used (incl. buffers/cache)

active

X

X

X

X

X

used actively (excl. buffers/cache)

buffcache

X

X

X

X

used by buffers+cache

buffers

X

used by buffers

cached

X

used by cache

slab

X

used by slab

available

X

X

X

X

X

potentially available (total - active)

swaptotal

X

X

X

X

X

swapused

X

X

X

X

X

swapfree

X

X

X

X

X

si.memLayout(cb)

[{...}]

X

X

X

X

Memory Layout (array)

[0].size

X

X

X

X

size in bytes

[0].bank

X

X

X

memory bank

[0].type

X

X

X

X

memory type

[0].clockSpeed

X

X

X

X

clock speed

[0].formFactor

X

X

X

form factor

[0].manufacturer

X

X

X

X

manufacturer

[0].partNum

X

X

X

X

part number

[0].serialNum

X

X

X

X

serial number

[0].voltageConfigured

X

X

X

voltage conf.

[0].voltageMin

X

X

X

voltage min

[0].voltageMax

X

X

X

voltage max

5. Battery

Function

Result object

Linux

BSD

Mac

Win

Sun

Comments

si.battery(cb)

{...}

X

X

X

X

battery information

hasbattery

X

X

X

X

indicates presence of battery

cyclecount

X

X

numbers of recharges

ischarging

X

X

X

X

indicates if battery is charging

designedcapacity

X

X

X

max capacity of battery (mWh)

maxcapacity

X

X

X

max capacity of battery (mWh)

currentcapacity

X

X

X

current capacity of battery (mWh)

capacityUnit

X

X

X

capacity unit (mWh)

voltage

X

X

X

current voltage of battery (V)

percent

X

X

X

X

charging level in percent

timeremaining

X

X

minutes left (if discharging)

acconnected

X

X

X

X

AC connected

type

X

X

battery type

model

X

X

model

manufacturer

X

X

manufacturer

serial

X

X

battery serial

See known issues if you have problem with macOS temperature or windows temperature

statistics for specific containerscontainer IDs: space or comma separated,pass '*' for all containers

[0].id

X

X

X

X

X

Container ID

[0].mem_usage

X

X

X

X

X

memory usage in bytes

[0].mem_limit

X

X

X

X

X

memory limit (max mem) in bytes

[0].mem_percent

X

X

X

X

X

memory usage in percent

[0].cpu_percent

X

X

X

X

X

cpu usage in percent

[0].pids

X

X

X

X

X

number of processes

[0].netIO.rx

X

X

X

X

X

received bytes via network

[0].netIO.wx

X

X

X

X

X

sent bytes via network

[0].blockIO.r

X

X

X

X

X

bytes read from BlockIO

[0].blockIO.w

X

X

X

X

X

bytes written to BlockIO

[0].cpu_stats

X

X

X

X

X

detailed cpu stats

[0].percpu_stats

X

X

X

X

X

detailed per cpu stats

[0].memory_stats

X

X

X

X

X

detailed memory stats

[0].networks

X

X

X

X

X

detailed network stats per interface

si.dockerContainerProcesses(id, cb)

[{...}]

X

X

X

X

X

array of processes inside a container

[0].pid_host

X

X

X

X

X

process ID (host)

[0].ppid

X

X

X

X

X

parent process ID

[0].pgid

X

X

X

X

X

process group ID

[0].user

X

X

X

X

X

effective user name

[0].ruser

X

X

X

X

X

real user name

[0].group

X

X

X

X

X

effective group name

[0].rgroup

X

X

X

X

X

real group name

[0].stat

X

X

X

X

X

process state

[0].time

X

X

X

X

X

accumulated CPU time

[0].elapsed

X

X

X

X

X

elapsed running time

[0].nice

X

X

X

X

X

nice value

[0].rss

X

X

X

X

X

resident set size

[0].vsz

X

X

X

X

X

virtual size in Kbytes

[0].command

X

X

X

X

X

command and arguments

si.dockerAll(cb)

{...}

X

X

X

X

X

list of all containers including their statsand processes in one single array

13. Virtual Box

Function

Result object

Linux

BSD

Mac

Win

Sun

Comments

si.vboxInfo(cb)

[{...}]

X

X

X

X

X

returns array general virtual box info

[0].id

X

X

X

X

X

virtual box ID

[0].name

X

X

X

X

X

name

[0].running

X

X

X

X

X

vbox is running

[0].started

X

X

X

X

X

started date time

[0].runningSince

X

X

X

X

X

running since (secs)

[0].stopped

X

X

X

X

X

stopped date time

[0].stoppedSince

X

X

X

X

X

stopped since (secs)

[0].guestOS

X

X

X

X

X

Guest OS

[0].hardwareUUID

X

X

X

X

X

Hardware UUID

[0].memory

X

X

X

X

X

Memory in MB

[0].vram

X

X

X

X

X

VRAM in MB

[0].cpus

X

X

X

X

X

CPUs

[0].cpuExepCap

X

X

X

X

X

CPU exec cap

[0].cpuProfile

X

X

X

X

X

CPU profile

[0].chipset

X

X

X

X

X

chipset

[0].firmware

X

X

X

X

X

firmware

[0].pageFusion

X

X

X

X

X

page fusion

[0].configFile

X

X

X

X

X

config file

[0].snapshotFolder

X

X

X

X

X

snapshot folder

[0].logFolder

X

X

X

X

X

log folder path

[0].HPET

X

X

X

X

X

HPET

[0].PAE

X

X

X

X

X

PAE

[0].longMode

X

X

X

X

X

long mode

[0].tripleFaultReset

X

X

X

X

X

triple fault reset

[0].APIC

X

X

X

X

X

APIC

[0].X2APIC

X

X

X

X

X

X2APIC

[0].ACPI

X

X

X

X

X

ACPI

[0].IOAPIC

X

X

X

X

X

IOAPIC

[0].biosAPICmode

X

X

X

X

X

BIOS APIC mode

[0].bootMenuMode

X

X

X

X

X

boot menu Mode

[0].bootDevice1

X

X

X

X

X

bootDevice1

[0].bootDevice2

X

X

X

X

X

bootDevice2

[0].bootDevice3

X

X

X

X

X

bootDevice3

[0].bootDevice4

X

X

X

X

X

bootDevice4

[0].timeOffset

X

X

X

X

X

time Offset

[0].RTC

X

X

X

X

X

RTC

14. "Get All at once" - functions

Function

Result object

Linux

BSD

Mac

Win

Sun

Comments

si.getStaticData(cb)

{...}

X

X

X

X

X

all static data at once

si.getDynamicData(srv,iface,cb)

{...}

X

X

X

X

X

all dynamic data at onceSpecify services and interfaces to monitorDefaults to first external network interfacePass "" for ALL services (linux/win only)Pass "" for ALL network interfaces

si.getAllData(srv,iface,cb)

{...}

X

X

X

X

X

all data at onceSpecify services and interfaces to monitorDefaults to first external network interfacePass "" for ALL services (linux/win only)Pass "" for ALL network interfaces

si.get(valueObject,cb)

{...}

X

X

X

X

X

get partial system info data at onceIn valueObject you can defineall values, you want to get back (see documentation for details)

cb: Asynchronous Function Calls (callback)

Remember: all functions (except version and time) are implemented as asynchronous functions! There are now three ways to consume them:

Callback Style

constsi=require('systeminformation');

si.cpu(function(data){

console.log('CPU Information:');

console.log('- manufucturer: '+data.manufacturer);

console.log('- brand: '+data.brand);

console.log('- speed: '+data.speed);

console.log('- cores: '+data.cores);

console.log('- physical cores: '+data.physicalCores);

console.log('...');

})

Promises

Promises Style is new in version 3.0.

When omitting callback parameter (cb), then you can use all function in a promise oriented way. All functions (exept of version and time) are returning a promise, that you can consume:

constsi=require('systeminformation');

si.cpu()

.then(data=>{

console.log('CPU Information:');

console.log('- manufucturer: '+data.manufacturer);

console.log('- brand: '+data.brand);

console.log('- speed: '+data.speed);

console.log('- cores: '+data.cores);

console.log('- physical cores: '+data.physicalCores);

console.log('...');

})

.catch(error=>console.error(error));

Async / Await

Using async / await (available since node v7.6)

Since node v7.6 you can also use the async / await pattern. The above example would then look like this:

constsi=require('systeminformation');

asyncfunctioncpuData(){

try{

constdata=awaitsi.cpu();

console.log('CPU Information:');

console.log('- manufucturer: '+data.manufacturer);

console.log('- brand: '+data.brand);

console.log('- speed: '+data.speed);

console.log('- cores: '+data.cores);

console.log('- physical cores: '+data.physicalCores);

console.log('...');

}catch(e){

console.log(e)

}

}

Known Issues

macOS - Temperature Sensor

To be able to measure temperature on macOS I created a little additional package. Due to some difficulties
in NPM with optionalDependencies I unfortunately was getting unexpected warnings on other platforms.
So I decided to drop this optional dependency for macOS - so by default, you will not get correct values.

But if you need to detect macOS temperature just run the following additional
installation command:

$ npm install osx-temperature-sensor --save

systeminformation will then detect this additional library and return the temperature when calling systeminformations standard function cpuTemperature()

Windows Temperature, Battery, ...

wmic - which is used to determine temperature and battery sometimes needs to be run with admin
privileges. So if you do not get any values, 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 temperature values.

Linux Temperature

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

Linux S.M.A.R.T. Status

To be able to detect S.M.A.R.T. status on Linux you need to install smartmontools. On DEBIAN based linux distributions you can install it by running sudo apt-get install smartmontools

*: Additional Notes

In fsStats(), disksIO() and networkStats() the results / sec. values (rx_sec, IOPS, ...) are calculated correctly beginning
with the second call of the function. It is determined by calculating the difference of transferred bytes / IOs
divided by the time between two calls of the function.

The first time you are calling one of this functions, you will get -1 for transfer rates. The second time, you should then get statistics based on the time between the two calls ...

So basically, if you e.g. need a values for network stats every second, your code should look like this:

constsi=require('systeminformation');

setInterval(function(){

si.networkStats().then(data=>{

console.log(data);

})

},1000)

Beginning with the second call, you get network transfer values per second.

Finding new issues

I am happy to discuss any comments and suggestions. Please feel free to contact me if you see any possibility of improvement!

Copyright Information

Linux is a registered trademark of Linus Torvalds. Apple, macOS, OS X are registered trademarks of Apple Inc.,
Windows is a registered trademark of Microsoft Corporation. Node.js is a trademark of Joyent Inc.,
Intel is a trademark of Intel Corporation, AMD is a trademark of Advanced Micro Devices Inc.,
Raspberry Pi is a trademark of the Raspberry Pi Foundation, Debian is a trademark of the Debian Project,
Ubuntu is a trademark of Canonical Ltd., FreeBSD is a registered trademark of The FreeBSD Foundation,
NetBSD is a registered trademark of The NetBSD Foundation, Docker is a trademark of Docker, Inc., Sun,
Solaris, OpenSolaris and registered trademarks of Sun Microsystems.

All other trademarks are the property of their respective owners.

License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.