In this section you will learn how to get information about current load, running processes and installed services:
For function reference and examples we assume, that we imported systeminformation as follows:
const si = require('systeminformation');
Current Load, Processes, Services
All functions in this section return a promise or can be called with a callback function (parameter cb in the function reference)
| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
|---|---|---|---|---|---|---|---|
| si.currentLoad(cb) | {...} | X | X | X | X | CPU-Load | |
| avgload | X | X | X | average load | |||
| currentload | X | X | X | X | CPU load in % | ||
| currentload_user | X | X | X | X | CPU load user in % | ||
| currentload_system | X | X | X | X | CPU load system in % | ||
| currentload_nice | X | X | X | X | CPU load nice in % | ||
| currentload_idle | X | X | X | X | CPU load idle in % | ||
| currentload_irq | X | X | X | X | CPU load system in % | ||
| raw_currentload... | X | X | X | X | CPU load raw values (ticks) | ||
| cpus[] | X | X | X | X | current loads per CPU in % + raw ticks | ||
| si.fullLoad(cb) | : integer | X | X | X | CPU full load since bootup in % | ||
| si.processes(cb) | {...} | X | X | X | X | X | # running processes |
| all | X | X | X | X | X | # of all processes | |
| running | X | X | X | X | X | # of all processes running | |
| blocked | X | X | X | X | X | # of all processes blocked | |
| sleeping | X | X | X | X | X | # of all processes sleeping | |
| unknown | X | # of all processes unknown status | |||||
| list[] | X | X | X | X | X | list of all processes incl. details | |
| ...[0].pid | X | X | X | X | X | process PID | |
| ...[0].parentPid | X | X | X | X | X | parent process PID | |
| ...[0].name | X | X | X | X | X | process name | |
| ...[0].pcpu | X | X | X | X | X | process % CPU usage | |
| ...[0].pcpuu | X | X | X | process % CPU usage (user) | |||
| ...[0].pcpus | X | X | X | process % CPU usage (system) | |||
| ...[0].pmem | X | X | X | X | X | process memory % | |
| ...[0].priority | X | X | X | X | X | process priotity | |
| ...[0].mem_vsz | X | X | X | X | X | process virtual memory size | |
| ...[0].mem_rss | X | X | X | X | X | process mem resident set size | |
| ...[0].nice | X | X | X | X | process nice value | ||
| ...[0].started | X | X | X | X | X | process start time | |
| ...[0].state | X | X | X | X | X | process state (e.g. sleeping) | |
| ...[0].tty | X | X | X | X | tty from which process was started | ||
| ...[0].user | X | X | X | X | user who started process | ||
| ...[0].command | X | X | X | X | X | process starting command | |
| ...[0].params | X | X | X | X | process params | ||
| ...[0].path | X | X | X | X | X | process path | |
| si.processLoad('apache2',cb) | {...} | X | X | X | X | detailed information about given process | |
| proc | X | X | X | X | process name | ||
| pid | X | X | X | X | PID | ||
| pids | X | X | X | X | additional pids | ||
| cpu | X | X | X | X | process % CPU | ||
| mem | X | X | X | X | process % MEM | ||
| si.services('mysql, apache2', cb) | [{...}] | X | X | X | X | pass comma separated string of services pass "*" for ALL services (linux/win only) |
|
| [0].name | X | X | X | X | name of service | ||
| [0].running | X | X | X | X | true / false | ||
| [0].startmode | X | manual, automatic, ... | |||||
| [0].pids | X | X | X | pids | |||
| [0].pcpu | X | X | X | process % CPU | |||
| [0].pmem | X | X | X | process % MEM |