Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @bigemap/systeminformation with all npm packages installed. Try it out:

var systeminformation = require("@bigemap/systeminformation")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@bigemap/systeminformation v4.15.3

Simple system and OS information library

systeminformation logo

systeminformation

System and OS information library for node.js
Explore Systeminformation docs »

Report bug · Request feature · Changelog

NPM Version NPM Downloads Git Issues Closed Issues deps status Code Quality: Javascript Total alerts Caretaker MIT license

This is amazing. Started as a small project just for myself, it now has > 9,000 lines of code, > 250 versions published, up to 900,000 downloads per month, > 2 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:

  • new systeminformation website with better documentation and examples systeminformation.io
  • added typescript definitions
  • reworked network section: this will now return more information and allows to get networkStats for more than one interface at once.
  • dockerContainerStats for multiple containers or all containers at once
  • optimized graphics controller and display detection
  • added wifiNetworks to get available wifi networks
  • added vboxInfo to get detailed vm information
  • added chassis information
  • better Raspberry-PI detection
  • lot of minor improvements

Breaking Changes: you will see some minor breaking changes. Read the detailed changelog.

Quick Start

Lightweight collection of 40+ functions to retrieve detailed hardware, system and OS information.

  • simple to use
  • get detailed information about system, cpu, baseboard, battery, memory, disks/filesystem, network, docker, software, services and processes
  • supports Linux, macOS, partial Windows, FreeBSD, OpenBSD, NetBSD and SunOS support
  • no npm dependencies (for production)

Installation

$ npm install @bigemap/systeminformation --save

Usage

All functions (except version and time) are implemented as asynchronous functions. Here a small example how to use them:

const si = require('@bigemap/systeminformation');

// promises style - new since version 3
si.cpu()
    .then(data => console.log(data))
    .catch(error => console.error(error));

Callback, Promises, Awync Await

News and Changes

Latest Activity

(last 7 major and minor version releases)

  • Version 4.15.0: cpu() added governor (linux)
  • Version 4.14.0: processes() added process path and params
  • Version 4.13.0: networkConnections() added PID, process
  • Version 4.12.0: networkInterfaces() added property virtual
  • Version 4.11.0: wifiNetworks() added available wifi networks
  • Version 4.10.0: graphics() added windows multiple display support, added display size, connection, ...
  • Version 4.9.0: graphics() added vendor, refresh rate, current resolution
  • ...

You can find all changes here: detailed changelog

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

FunctionResult objectLinuxBSDMacWinSunComments
si.version(): stringXXXXXlib version (no callback/promise)
si.time(){...}XXXXX(no callback/promise)
currentXXXXXlocal (server) time
uptimeXXXXXuptime
timezoneXXXXXe.g. GMT+0200
timezoneNameXXXXXe.g. CEST

2. System (HW)

FunctionResult objectLinuxBSDMacWinSunComments
si.system(cb){...}XXXXhardware information
manufacturerXXXXe.g. 'MSI'
modelXXXXmodel/product e.g. 'MS-7823'
versionXXXXversion e.g. '1.0'
serialXXXXserial number
uuidXXXXUUID
skuXXXXSKU number
si.bios(cb){...}XXXXbios information
vendorXXXXe.g. 'AMI'
versionXXXversion
releaseDateXXXrelease date
revisionXXXrevision
si.baseboard(cb){...}XXXXbaseboard information
manufacturerXXXXe.g. 'ASUS'
modelXXXXmodel / product name
versionXXXXversion
serialXXXXserial number
assetTagXXXXasset tag
si.chassis(cb){...}XXXXchassis information
manufacturerXXXXe.g. 'MSI'
modelXXXXmodel / product name
typeXXXXmodel / product name
versionXXXXversion
serialXXXXserial number
assetTagXXXXasset tag
skuXSKU number

3. CPU

FunctionResult objectLinuxBSDMacWinSunComments
si.cpu(cb){...}XXXXCPU information
manufacturerXXXXe.g. 'Intel(R)'
brandXXXXe.g. 'Core(TM)2 Duo'
speedXXXXin GHz e.g. '3.40'
speedminXXXin GHz e.g. '0.80'
speedmaxXXXXin GHz e.g. '3.90'
governorXe.g. 'powersave'
coresXXXX# cores
physicalCoresXXXX# physical cores
processorsXXXX# processors
socketXXXsocket type e.g. "LGA1356"
vendorXXXXvendor ID
familyXXXXprocessor family
modelXXXXprocessor model
steppingXXXXprocessor stepping
revisionXXXrevision
voltageXvoltage
cacheXXXXcache in bytes (object)
cache.l1dXXXXL1D (data) size
cache.l1iXXXXL1I (instruction) size
cache.l2XXXXL2 size
cache.l3XXXXL3 size
si.cpuFlags(cb): stringXXXXCPU flags
si.cpuCache(cb){...}XXXXCPU cache sizes
l1dXXXXL1D size
l1iXXXXL1I size
l2XXXXL2 size
l3XXXXL3 size
si.cpuCurrentspeed(cb){...}XXXXXcurrent CPU speed (in GHz)
avgXXXXXavg CPU speed (all cores)
minXXXXXmin CPU speed (all cores)
maxXXXXXmax CPU speed (all cores)
coresXXXXXCPU speed per core (array)
si.cpuTemperature(cb){...}XXX*XCPU temperature (if supported)
mainXXXXmain temperature (avg)
coresXXXXarray of temperatures
maxXXXXmax temperature

4. Memory

FunctionResult objectLinuxBSDMacWinSunComments
si.mem(cb){...}XXXXXMemory information (in bytes)
totalXXXXXtotal memory in bytes
freeXXXXXnot used in bytes
usedXXXXXused (incl. buffers/cache)
activeXXXXXused actively (excl. buffers/cache)
buffcacheXXXXused by buffers+cache
buffersXused by buffers
cachedXused by cache
slabXused by slab
availableXXXXXpotentially available (total - active)
swaptotalXXXXX
swapusedXXXXX
swapfreeXXXXX
si.memLayout(cb)[{...}]XXXXMemory Layout (array)
[0].sizeXXXXsize in bytes
[0].bankXXXmemory bank
[0].typeXXXXmemory type
[0].clockSpeedXXXXclock speed
[0].formFactorXXXform factor
[0].manufacturerXXXXmanufacturer
[0].partNumXXXXpart number
[0].serialNumXXXXserial number
[0].voltageConfiguredXXXvoltage conf.
[0].voltageMinXXXvoltage min
[0].voltageMaxXXXvoltage max

5. Battery

FunctionResult objectLinuxBSDMacWinSunComments
si.battery(cb){...}XXXXbattery information
hasbatteryXXXXindicates presence of battery
cyclecountXXnumbers of recharges
ischargingXXXXindicates if battery is charging
maxcapacityXXXmax capacity of battery
currentcapacityXXXcurrent capacity of battery
percentXXXXcharging level in percent
timeremainingXXminutes left (if discharging)
acconnectedXXXXAC connected
typeXXbattery type
modelXXmodel
manufacturerXXmanufacturer
serialXXbattery serial
  • See known issues if you have problem with macOS temperature or windows temperature

6. Graphics

FunctionResult objectLinuxBSDMacWinSunComments
si.graphics(cb){...}XXXarrays of graphics controllers and displays
controllers[]XXXgraphics controllers array
...[0].modelXXXgraphics controller model
...[0].vendorXXXe.g. ATI
...[0].busXXXon which bus (e.g. PCIe)
...[0].vramXXXVRAM size (in MB)
...[0].vramDynamicXXXtrue if dynamicly allocated ram
displays[]XXXmonitor/display array
...[0].vendorXmonitor/display vendor
...[0].modelXXXmonitor/display model
...[0].mainXXXtrue if main monitor
...[0].builtinXXtrue if built in monitor
...[0].connectionXXXe.g. DisplayPort or HDMI
...[0].sizexXXXsize in mm horizontal
...[0].sizeyXXXsize in mm vertical
...[0].pixeldepthXXXcolor depth in bits
...[0].resolutionxXXXpixel horizontal
...[0].resolutionyXXXpixel vertical
...[0].currentResXXXXcurrent pixel horizontal
...[0].currentResYXXXcurrent pixel vertical
...[0].positionXXdisplay position X
...[0].positionYXdisplay position Y
...[0].currentRefreshRateXXXcurrent pixel vertical

7. Operating System

FunctionResult objectLinuxBSDMacWinSunComments
si.osInfo(cb){...}XXXXXOS information
platformXXXXX'Linux', 'Darwin', 'Windows'
distroXXXXX
releaseXXXXX
codenameX
kernelXXXXXkernel release - same as os.release()
archXXXXXsame as os.arch()
hostnameXXXXXsame as os.hostname()
codepageXXXXOS build version
logofileXXXXXe.g. 'apple', 'debian', 'fedora', ...
serialXXXXOS/Host serial number
buildXXXOS build version
servicepackXservice pack version
si.uuid(cb){...}XXXXXobject of several UUIDs
osXXXXos specific UUID
si.versions(cb){...}XXXXXversion information (kernel, ssl, node, ...)
si.shell(cb): stringXXXstandard shell
si.users(cb)[{...}]XXXXXarray of users online
[0].userXXXXXuser name
[0].ttyXXXXXterminal
[0].dateXXXXXlogin date
[0].timeXXXXXlogin time
[0].ipXXXXip address (remote login)
[0].commandXXXXlast command or shell

8. Current Load, Processes & Services

FunctionResult objectLinuxBSDMacWinSunComments
si.currentLoad(cb){...}XXXXCPU-Load
avgloadXXXaverage load
currentloadXXXXCPU load in %
currentload_userXXXXCPU load user in %
currentload_systemXXXXCPU load system in %
currentload_niceXXXXCPU load nice in %
currentload_idleXXXXCPU load idle in %
currentload_irqXXXXCPU load system in %
raw_currentload...XXXXCPU load raw values (ticks)
cpus[]XXXXcurrent loads per CPU in % + raw ticks
si.fullLoad(cb): integerXXXCPU full load since bootup in %
si.processes(cb){...}XXXXX# running processes
allXXXXX# of all processes
runningXXXXX# of all processes running
blockedXXXXX# of all processes blocked
sleepingXXXXX# of all processes sleeping
unknownX# of all processes unknown status
list[]XXXXXlist of all processes incl. details
...[0].pidXXXXXprocess PID
...[0].parentPidXXXXXparent process PID
...[0].nameXXXXXprocess name
...[0].pcpuXXXXXprocess % CPU usage
...[0].pcpuuXXXprocess % CPU usage (user)
...[0].pcpusXXXprocess % CPU usage (system)
...[0].pmemXXXXXprocess memory %
...[0].priorityXXXXXprocess priotity
...[0].mem_vszXXXXXprocess virtual memory size
...[0].mem_rssXXXXXprocess mem resident set size
...[0].niceXXXXprocess nice value
...[0].startedXXXXXprocess start time
...[0].stateXXXXXprocess state (e.g. sleeping)
...[0].ttyXXXXtty from which process was started
...[0].userXXXXuser who started process
...[0].commandXXXXXprocess starting command
...[0].paramsXXXXprocess params
...[0].pathXXXXXprocess path
procXXXXprocess name
pidXXXXPID
pidsXXXXadditional pids
cpuXXXXprocess % CPU
memXXXXprocess % MEM
si.services('mysql, apache2', cb)[{...}]XXXXpass comma separated string of services
pass "*" for ALL services (linux/win only)
[0].nameXXXXname of service
[0].runningXXXXtrue / false
[0].startmodeXmanual, automatic, ...
[0].pidsXXXpids
[0].pcpuXXXprocess % CPU
[0].pmemXXXprocess % MEM

9. File System

FunctionResult objectLinuxBSDMacWinSunComments
si.diskLayout(cb)[{...}]XXXphysical disk layout (array)
[0].deviceXXe.g. /dev/sda
[0].typeXXXHD, SSD, NVMe
[0].nameXXXdisk name
[0].vendorXXvendor/producer
[0].sizeXXXsize in bytes
[0].bytesPerSectorXbytes per sector
[0].totalCylindersXtotal cylinders
[0].totalHeadsXtotal heads
[0].totalSectorsXtotal sectors
[0].totalTracksXtotal tracks
[0].tracksPerCylinderXtracks per cylinder
[0].sectorsPerTrackXsectors per track
[0].firmwareRevisionXXXfirmware revision
[0].serialNumXXXserial number
[0].interfaceTypeXXSATA, PCIe, ...
[0].mediaTypeXmedia type
[0].smartStatusXXXS.M.A.R.T Status (see Known Issues)
si.blockDevices(cb)[{...}]XXXreturns array of disks, partitions,
raids and roms
[0].nameXXXname
[0].typeXXXtype
[0].fstypeXXXfile system type (e.g. ext4)
[0].mountXXXmount point
[0].sizeXXXsize in bytes
[0].physicalXXXphysical type (HDD, SSD, CD/DVD)
[0].uuidXXXUUID
[0].labelXXXlabel
[0].modelXXmodel
[0].serialXXserial
[0].removableXXXserial
[0].protocolXXprotocol (SATA, PCI-Express, ...)
si.disksIO(cb){...}XXcurrent transfer stats
rIOXXread IOs on all mounted drives
wIOXXwrite IOs on all mounted drives
tIOXXwrite IOs on all mounted drives
rIO_secXXread IO per sec (* see notes)
wIO_secXXwrite IO per sec (* see notes)
tIO_secXXtotal IO per sec (* see notes)
msXXinterval length (for per second values)
si.fsSize(cb)[{...}]XXXXreturns array of mounted file systems
[0].fsXXXXname of file system
[0].typeXXXXtype of file system
[0].sizeXXXXsizes in bytes
[0].usedXXXXused in bytes
[0].useXXXXused in %
[0].mountXXXXmount point
si.fsOpenFiles(cb){...}XXXcount max/allocated file descriptors
maxXXXmax file descriptors
allocatedXXXcurrent open files count
availableXXXcount available
si.fsStats(cb){...}XXcurrent transfer stats
rxXXbytes read since startup
wxXXbytes written since startup
txXXtotal bytes read + written since startup
rx_secXXbytes read / second (* see notes)
wx_secXXbytes written / second (* see notes)
tx_secXXtotal bytes reads + written / second
msXXinterval length (for per second values)

10. Network related functions

FunctionResult objectLinuxBSDMacWinSunComments
si.networkInterfaces(cb)[{...}]XXXXXarray of network interfaces
[0].ifaceXXXXXinterface
[0].ifaceNameXXXXXinterface name (differs on Windows)
[0].ip4XXXXXip4 address
[0].ip6XXXXXip6 address
[0].macXXXXXMAC address
[0].internalXXXXXtrue if internal interface
[0].virtualXXXXXtrue if virtual interface
[0].operstateXXXup / down
[0].typeXXXwireless / wired
[0].duplexXXduplex
[0].mtuXXmaximum transmission unit
[0].speedXXXspeed in MBit / s
[0].carrierChangesX# changes up/down
si.networkInterfaceDefault(cb): stringXXXXXget name of default network interface
si.networkGatewayDefault(cb): stringXXXXXget default network gateway
si.networkStats(ifaces,cb)[{...}]XXXXcurrent network stats of given interfaces
iface list: space or comma separated
iface parameter is optional
defaults to first external network interface,
Pass '*' for all interfaces
[0].ifaceXXXXinterface
[0].operstateXXXXup / down
[0].rx_bytesXXXXreceived bytes overall
[0].rx_droppedXXXXreceived dropped overall
[0].rx_errorsXXXXreceived errors overall
[0].tx_bytesXXXXtransferred bytes overall
[0].tx_droppedXXXXtransferred dropped overall
[0].tx_errorsXXXXtransferred errors overall
[0].rx_secXXXXreceived bytes / second (* see notes)
[0].tx_secXXXXtransferred bytes per second (* see notes)
[0].msXXXXinterval length (for per second values)
si.networkConnections(cb)[{...}]XXXXcurrent network network connections
returns an array of all connections
[0].protocolXXXXtcp or udp
[0].localaddressXXXXlocal address
[0].localportXXXXlocal port
[0].peeraddressXXXXpeer address
[0].peerportXXXXpeer port
[0].stateXXXXlike ESTABLISHED, TIME_WAIT, ...
[0].pidXXXXprocess ID
[0].processXXprocess name
si.inetChecksite(url, cb){...}XXXXXresponse-time (ms) to fetch given URL
urlXXXXXgiven url
okXXXXXstatus code OK (2xx, 3xx)
statusXXXXXstatus code
msXXXXXresponse time in ms
si.inetLatency(host, cb): numberXXXXXresponse-time (ms) to external resource
host parameter is optional (default 8.8.8.8)

11. Wifi networks

FunctionResult objectLinuxBSDMacWinSunComments
si.wifiNetworks(cb)[{...}]XXXarray of available wifi networks
[0].ssidXXXWifi network SSID
[0].bssidXXXBSSID (mac)
[0].modeXmode
[0].channelXXXchannel
[0].frequencyXXXfrequengy in MHz
[0].signalLevelXXXsignal level in dB
[0].qualityXXXquaility in %
[0].securityXXXarray e.g. WPA, WPA-2
[0].wpaFlagsXXXarray of WPA flags
[0].rsnFlagsXarray of RDN flags

12. Docker

FunctionResult objectLinuxBSDMacWinSunComments
si.dockerInfo(cb){...}XXXXXreturns general docker info
idXXXXXDocker ID
containersXXXXXnumber of containers
containersRunningXXXXXnumber of running containers
containersPausedXXXXXnumber of paused containers
containersStoppedXXXXXnumber of stopped containers
imagesXXXXXnumber of images
driverXXXXXdriver (e.g. 'devicemapper', 'overlay2')
memoryLimitXXXXXhas memory limit
swapLimitXXXXXhas swap limit
kernelMemoryXXXXXhas kernal memory
cpuCfsPeriodXXXXXhas CpuCfsPeriod
cpuCfsQuotaXXXXXhas CpuCfsQuota
cpuSharesXXXXXhas CPUShares
cpuSetXXXXXhas CPUShares
ipv4ForwardingXXXXXhas IPv4Forwarding
bridgeNfIptablesXXXXXhas BridgeNfIptables
bridgeNfIp6tablesXXXXXhas BridgeNfIp6tables
debugXXXXXDebug on
nfdXXXXXnamed data networking forwarding daemon
oomKillDisableXXXXXout-of-memory kill disabled
ngoroutinesXXXXXnumber NGoroutines
systemTimeXXXXXdocker SystemTime
loggingDriverXXXXXlogging driver e.g. 'json-file'
cgroupDriverXXXXXcgroup driver e.g. 'cgroupfs'
nEventsListenerXXXXXnumber NEventsListeners
kernelVersionXXXXXdocker kernel version
operatingSystemXXXXXdocker OS e.g. 'Docker for Mac'
osTypeXXXXXOSType e.g. 'linux'
architectureXXXXXarchitecture e.g. x86_64
ncpuXXXXXnumber of CPUs
memTotalXXXXXmemory total
dockerRootDirXXXXXdocker root directory
httpProxyXXXXXhttp proxy
httpsProxyXXXXXhttps proxy
noProxyXXXXXNoProxy
nameXXXXXName
labelsXXXXXarray of labels
experimentalBuildXXXXXis experimental build
serverVersionXXXXXserver version
clusterStoreXXXXXcluster store
clusterAdvertiseXXXXXcluster advertise
defaultRuntimeXXXXXdefault runtime e.g. 'runc'
liveRestoreEnabledXXXXXlive store enabled
isolationXXXXXisolation
initBinaryXXXXXinit binary
productLicenseXXXXXproduct license
si.dockerContainers(all, cb)[{...}]XXXXXreturns array of active/all docker containers
[0].idXXXXXID of container
[0].nameXXXXXname of container
[0].imageXXXXXname of image
[0].imageIDXXXXXID of image
[0].commandXXXXXcommand
[0].createdXXXXXcreation time (unix)
[0].startedXXXXXcreation time (unix)
[0].finishedXXXXXcreation time (unix)
[0].createdAtXXXXXcreation date time string
[0].startedAtXXXXXcreation date time string
[0].finishedAtXXXXXcreation date time string
[0].stateXXXXXcreated, running, exited
[0].portsXXXXXarray of ports
[0].mountsXXXXXarray of mounts
si.dockerContainerStats(ids, cb)[{...}]XXXXXstatistics for specific containers
container IDs: space or comma separated,
pass '*' for all containers
[0].idXXXXXContainer ID
[0].mem_usageXXXXXmemory usage in bytes
[0].mem_limitXXXXXmemory limit (max mem) in bytes
[0].mem_percentXXXXXmemory usage in percent
[0].cpu_percentXXXXXcpu usage in percent
[0].pidsXXXXXnumber of processes
[0].netIO.rxXXXXXreceived bytes via network
[0].netIO.wxXXXXXsent bytes via network
[0].blockIO.rXXXXXbytes read from BlockIO
[0].blockIO.wXXXXXbytes written to BlockIO
[0].cpu_statsXXXXXdetailed cpu stats
[0].percpu_statsXXXXXdetailed per cpu stats
[0].memory_statsXXXXXdetailed memory stats
[0].networksXXXXXdetailed network stats per interface
si.dockerContainerProcesses(id, cb)[{...}]XXXXXarray of processes inside a container
[0].pid_hostXXXXXprocess ID (host)
[0].ppidXXXXXparent process ID
[0].pgidXXXXXprocess group ID
[0].userXXXXXeffective user name
[0].ruserXXXXXreal user name
[0].groupXXXXXeffective group name
[0].rgroupXXXXXreal group name
[0].statXXXXXprocess state
[0].timeXXXXXaccumulated CPU time
[0].elapsedXXXXXelapsed running time
[0].niceXXXXXnice value
[0].rssXXXXXresident set size
[0].vszXXXXXvirtual size in Kbytes
[0].commandXXXXXcommand and arguments
si.dockerAll(cb){...}XXXXXlist of all containers including their stats
and processes in one single array

13. Virtual Box

FunctionResult objectLinuxBSDMacWinSunComments
si.vboxInfo(cb)[{...}]XXXXXreturns array general virtual box info
[0].idXXXXXvirtual box ID
[0].nameXXXXXname
[0].runningXXXXXvbox is running
[0].startedXXXXXstarted date time
[0].runningSinceXXXXXrunning since (secs)
[0].stoppedXXXXXstopped date time
[0].stoppedSinceXXXXXstopped since (secs)
[0].guestOSXXXXXGuest OS
[0].hardwareUUIDXXXXXHardware UUID
[0].memoryXXXXXMemory in MB
[0].vramXXXXXVRAM in MB
[0].cpusXXXXXCPUs
[0].cpuExepCapXXXXXCPU exec cap
[0].cpuProfileXXXXXCPU profile
[0].chipsetXXXXXchipset
[0].firmwareXXXXXfirmware
[0].pageFusionXXXXXpage fusion
[0].configFileXXXXXconfig file
[0].snapshotFolderXXXXXsnapshot folder
[0].logFolderXXXXXlog folder path
[0].HPETXXXXXHPET
[0].PAEXXXXXPAE
[0].longModeXXXXXlong mode
[0].tripleFaultResetXXXXXtriple fault reset
[0].APICXXXXXAPIC
[0].X2APICXXXXXX2APIC
[0].ACPIXXXXXACPI
[0].IOAPICXXXXXIOAPIC
[0].biosAPICmodeXXXXXBIOS APIC mode
[0].bootMenuModeXXXXXboot menu Mode
[0].bootDevice1XXXXXbootDevice1
[0].bootDevice2XXXXXbootDevice2
[0].bootDevice3XXXXXbootDevice3
[0].bootDevice4XXXXXbootDevice4
[0].timeOffsetXXXXXtime Offset
[0].RTCXXXXXRTC

14. "Get All at once" - functions

FunctionResult objectLinuxBSDMacWinSunComments
si.getStaticData(cb){...}XXXXXall static data at once
si.getDynamicData(srv,iface,cb){...}XXXXXall dynamic data at once
Specify services and interfaces to monitor
Defaults to first external network interface
Pass "" for ALL services (linux/win only)
Pass "
" for ALL network interfaces
si.getAllData(srv,iface,cb){...}XXXXXall data at once
Specify services and interfaces to monitor
Defaults to first external network interface
Pass "" for ALL services (linux/win only)
Pass "
" for ALL network interfaces

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

const si = require('@bigemap/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:

const si = require('@bigemap/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:

const si = require('@bigemap/systeminformation');

async function cpuData() {
    try {
        const data = await si.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:

const si = require('@bigemap/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!

Comments

If you have ideas or comments, please do not hesitate to contact me.

Happy monitoring!

Sincerely,

Sebastian Hildebrandt, +innovations

Credits

Written by Sebastian Hildebrandt sebhildebrandt

Contributers

OSX Temperature: credits here are going to:

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 MIT license

The MIT License (MIT)

Copyright © 2014-2019 Sebastian Hildebrandt, +innovations.

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.

Further details see LICENSE file.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free