This commit is contained in:
Sebastian Hildebrandt 2020-02-17 05:57:46 +01:00
commit cee13b95ef
18 changed files with 536 additions and 18 deletions

View File

@ -30,6 +30,8 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 4.21.3 | 2020-02-16 | `versions()` fixed mysql version (macOS) |
| 4.21.2 | 2020-02-11 | `networkConnections()` fixed linux (debian) issue |
| 4.21.1 | 2020-01-31 | `networkGatewayDefault()` fixed windows 7 issue |
| 4.21.0 | 2020-01-27 | `npx` compatibility |
| 4.20.1 | 2020-01-26 | `battery()` code refactoring, cleanup, updated docs |

View File

@ -27,9 +27,10 @@
[![Code Quality: Javascript][lgtm-badge]][lgtm-badge-url]
[![Total alerts][lgtm-alerts]][lgtm-alerts-url]
[![Caretaker][caretaker-image]][caretaker-url]
[![Sponsoring][sponsor-badge]][sponsor-url]
[![MIT license][license-img]][license-url]
This is amazing. Started as a small project just for myself, it now has > 9,000 lines of code, > 250 versions published, up to 1 mio downloads per month, > 4 mio downloads overall. Thank you to all who contributed to this project!
This is amazing. Started as a small project just for myself, it now has > 9,000 lines of code, > 250 versions published, up to 1 mio downloads per month, > 5 mio downloads overall. Thank you to all who contributed to this project!
## New Version 4.0
@ -850,6 +851,9 @@ All other trademarks are the property of their respective owners.
[lgtm-alerts]: https://img.shields.io/lgtm/alerts/g/sebhildebrandt/systeminformation.svg?style=flat-square
[lgtm-alerts-url]: https://lgtm.com/projects/g/sebhildebrandt/systeminformation/alerts
[sponsor-badge]: https://img.shields.io/badge/-Buy%20me%20a%20coffee-blue?style=flat-square
[sponsor-url]: https://www.buymeacoffee.com/systeminfo
[license-url]: https://github.com/sebhildebrandt/systeminformation/blob/master/LICENSE
[license-img]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
[npmjs-license]: https://img.shields.io/npm/l/systeminformation.svg?style=flat-square

View File

@ -225,7 +225,7 @@
<td></td>
<td>battery serial</td>
</tr>
<tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
@ -248,8 +248,7 @@ si.battery().then(data => console.log(data));</code></pre class="example">
model: '',
manufacturer: 'Apple',
serial: 'F9Y19860Y9AH9XBAX'
}
</pre>
}</pre>
</tr>
</tbody>
</table>

View File

@ -285,6 +285,34 @@
<td></td>
<td>L3 size</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.cpu().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
manufacturer: 'Intel®',
brand: 'Core™ i9-9900',
vendor: 'GenuineIntel',
family: '6',
model: '158',
stepping: '13',
revision: '',
voltage: '',
speed: '3.10',
speedmin: '0.80',
speedmax: '5.00',
governor: 'powersave',
cores: 16,
physicalCores: 8,
processors: 1,
socket: 'LGA1151',
cache: { l1d: 262144, l1i: 262144, l2: 2, l3: 16 },
flags: 'fpu vme de pse ...'
}</pre>
</tr>
<tr>
<td>si.cpuFlags(cb)</td>
<td>: string</td>
@ -295,6 +323,16 @@
<td></td>
<td>CPU flags</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.cpuFlags().then(data => console.log(data));</code></pre class="example">
<pre class="example">
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
</pre>
</tr>
<tr>
<td>si.cpuCache(cb)</td>
<td>{...}</td>
@ -345,6 +383,16 @@
<td></td>
<td>L3 size</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.cpuCache().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{ l1d: 262144, l1i: 262144, l2: 2, l3: 16 }
</pre>
</tr>
<tr>
<td>si.cpuCurrentspeed(cb)</td>
<td>{...}</td>
@ -395,6 +443,26 @@
<td>X</td>
<td>CPU speed per core (array)</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.cpuCurrentspeed().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
min: 0.86,
max: 1.77,
avg: 1.49,
cores: [
1.59, 1.71, 1.62, 1.57,
1.66, 1.77, 1.74, 1.75,
1.49, 1.51, 1.52, 1.59,
1.56, 1.03, 0.86, 0.86
]
}
</pre>
</tr>
<tr>
<td>si.cpuTemperature(cb)</td>
<td>{...}</td>
@ -435,6 +503,16 @@
<td></td>
<td>max temperature</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.cpuCurrentspeed().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{ main: 42, cores: [], max: 42 }
</pre>
</tr>
</tbody>
</table>
<h2>Known issues</h2>

View File

@ -295,6 +295,44 @@
<td></td>
<td>current refresh rate</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.graphics().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
controllers: [
{
vendor: 'Intel',
model: 'Intel Iris Plus Graphics 655',
bus: 'Built-In',
vram: 1536,
vramDynamic: true
}
],
displays: [
{
vendor: '',
model: 'Color LCD',
main: true,
builtin: false,
connection: 'Internal',
sizex: -1,
sizey: -1,
pixeldepth: 24,
resolutionx: 2560,
resolutiony: 1600,
currentResX: 2560,
currentResY: 1600,
positionX: 0,
positionY: 0,
currentRefreshRate: -1
}
]
}</pre>
</tr>
</tbody>
</table>
</div>

View File

@ -83,6 +83,16 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">4.21.3</th>
<td>2020-02-16</td>
<td><span class="code">versions()</span> fixed versions mysql (macOS)</td>
</tr>
<tr>
<th scope="row">4.21.2</th>
<td>2020-02-11</td>
<td><span class="code">networkConnections()</span> fixed linux (debian) issue</td>
</tr>
<tr>
<th scope="row">4.21.1</th>
<td>2020-01-31</td>

View File

@ -168,11 +168,12 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span></div>
<div class="version">Current Version: <span id="version">4.21.1</span></div>
<div class="version">Current Version: <span id="version">4.21.3</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">
Read Documentation<br>
<button class="btn btn-primary mb-2" onclick="location.href='https://www.buymeacoffee.com/systeminfo'">Buy me a coffee&nbsp;&nbsp;<i class="far fa-mug-hot"></i></button>
<br>Read Documentation<br>
<i class="fal fa-caret-down caret"></i>
</div>
</header>
@ -206,7 +207,7 @@
<div class="title">Downloads last month</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">244</div>
<div class="numbers">248</div>
<div class="title">Dependends</div>
</div>
</div>

View File

@ -195,6 +195,29 @@
<td>X</td>
<td></td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.mem().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
total: 67092135936,
free: 65769291776,
used: 1322844160,
active: 1032495104,
available: 66059640832,
buffers: 63213568,
cached: 800124928,
slab: 268804096,
buffcache: 1132142592,
swaptotal: 8589930496,
swapused: 0,
swapfree: 8589930496
}
</pre>
</tr>
<tr>
<td>si.memLayout(cb)</td>
<td>[{...}]</td>
@ -315,6 +338,43 @@
<td></td>
<td>voltage max</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.memLayout().then(data => console.log(data));</code></pre class="example">
<pre class="example">
[
{
size: 34359738368,
bank: 'BANK 0',
type: 'DDR4',
clockSpeed: 2667,
formFactor: 'SODIMM',
manufacturer: '029E',
partNum: 'CMSX64.....',
serialNum: '00000000',
voltageConfigured: 1.2,
voltageMin: 1.2,
voltageMax: 1.2
},
{
size: 34359738368,
bank: 'BANK 2',
type: 'DDR4',
clockSpeed: 2667,
formFactor: 'SODIMM',
manufacturer: '029E',
partNum: 'CMSX64.....',
serialNum: '00000000',
voltageConfigured: 1.2,
voltageMin: 1.2,
voltageMax: 1.2
}
]
</pre>
</tr>
</tbody>
</table>
</div>

View File

@ -205,6 +205,29 @@
<td></td>
<td>OS uses UEFI on startup</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.osInfo().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
platform: 'darwin',
distro: 'Mac OS X',
release: '10.15.3',
codename: 'macOS Catalina',
kernel: '19.3.0',
arch: 'x64',
hostname: 'hostname.local',
codepage: 'UTF-8',
logofile: 'apple',
serial: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
build: '19D76',
servicepack: '',
uefi: true
}</pre>
</tr>
<tr>
<td>si.uuid(cb)</td>
<td>{...}</td>
@ -525,6 +548,46 @@
<td>X</td>
<td>virtualbox version</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.versions().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
kernel: '19.3.0',
openssl: '1.1.1d',
systemOpenssl: '2.8.3',
systemOpensslLib: 'LibreSSL',
node: '13.8.0',
v8: '7.9.317.25-node.28',
npm: '6.13.6',
yarn: '',
pm2: '',
gulp: '',
grunt: '',
git: '2.21.1',
tsc: '3.7.5',
mysql: 'gpl)',
redis: '',
mongodb: '',
apache: '2.4.41 (Unix)',
nginx: '',
php: '7.3.11',
docker: '19.03.5',
postfix: '3.2.2',
postgresql: '12.1',
perl: '5.18.4',
python: '2.7.16',
python3: '3.7.3',
pip: '',
pip3: '19.0.3',
java: '',
gcc: '4.2.1',
virtualbox: ''
}</pre>
</tr>
<tr>
<td>si.users(cb)</td>
<td>[{...}]</td>
@ -595,6 +658,32 @@
<td>X</td>
<td>last command or shell</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.users().then(data => console.log(data));</code></pre class="example">
<pre class="example">
[
{
user: 'yourname',
tty: 'ttys006',
date: '2020-02-01',
time: '21:20',
ip: '',
command: 'w -ih'
},
{
user: 'othername',
tty: 'ttys008',
date: '2020-02-01',
time: '21:20',
ip: '',
command: '-bash'
}
]</pre>
</tr>
</tbody>
</table>
</div>

View File

@ -165,6 +165,46 @@
<td>X</td>
<td>current loads per CPU in % + raw ticks</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.currentLoad().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
avgload: 0.23,
currentload: 4.326328800988875,
currentload_user: 2.595797280593325,
currentload_system: 1.73053152039555,
currentload_nice: 0,
currentload_idle: 95.67367119901112,
currentload_irq: 0,
raw_currentload: 350,
raw_currentload_user: 210,
raw_currentload_system: 140,
raw_currentload_nice: 0,
raw_currentload_idle: 7740,
raw_currentload_irq: 0,
cpus: [
{
load: 13.725490196078432,
load_user: 7.8431372549019605,
load_system: 5.88235294117647,
load_nice: 0,
load_idle: 86.27450980392157,
load_irq: 0,
raw_load: 140,
raw_load_user: 80,
raw_load_system: 60,
raw_load_nice: 0,
raw_load_idle: 880,
raw_load_irq: 0
},
...
]
}</pre>
</tr>
<tr>
<td>si.fullLoad(cb)</td>
<td>: integer</td>
@ -425,8 +465,46 @@
<td>X</td>
<td>process path</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.processes().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
all: 258,
running: 1,
blocked: 0,
sleeping: 157,
unknown: 0,
list: [
{
pid: 1,
parentPid: 0,
name: 'init',
pcpu: 0.04504576931569955,
pcpuu: 0.04084113255431208,
pcpus: 0.00420463676138747,
pmem: 0,
priority: 19,
mem_vsz: 166144,
mem_rss: 10684,
nice: 0,
started: '2020-02-08 10:18:15',
state: 'sleeping',
tty: '',
user: 'root',
command: 'init',
params: '',
path: '/sbin'
},
...
]
}</pre>
</tr>
<tr>
<td>si.processLoad('apache2',cb)</td>
<td>si.processLoad('nginx',cb)</td>
<td>{...}</td>
<td>X</td>
<td>X</td>
@ -485,6 +563,28 @@
<td></td>
<td>process % MEM</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.processLoad('nginx').then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
proc: 'nginx',
pid: 11267,
pids: [
11251, 11252, 11253,
11254, 11255, 11256,
11257, 11258, 11259,
11260, 11261, 11262,
11263, 11264, 11265,
11266, 11267
],
cpu: 0.01,
mem: 0
}</pre>
</tr>
<tr>
<td>si.services('mysql, apache2', cb)</td>
<td>[{...}]</td>
@ -555,6 +655,32 @@
<td></td>
<td>process % MEM</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.services('mysql, postgres').then(data => console.log(data));</code></pre class="example">
<pre class="example">
[
{
name: 'mysql',
running: true,
startmode: '',
pids: [ 152 ],
pcpu: 0.3,
pmem: 0
},
{
name: 'postgres',
running: true,
startmode: '',
pids: [ 1087, 1873 ],
pcpu: 0,
pmem: 0
},
]</pre>
</tr>
</tbody>
</table>
<h4>Getting correct stats values</h4>

View File

@ -586,10 +586,27 @@ pre {
text-align: left;
}
.example {
.example td:first-child {
background-color: #fff !important;
}
.example td:last-child {
background-color: #f8faff !important;
}
.example h5 {
padding-top: 5px;
padding-left: 10px;
}
.example pre {
background-color: unset;
}
.example pre .js {
background-color: #f0f0f4;
}
footer {
background-color: #eee;
margin-top: 30px;

File diff suppressed because one or more lines are too long

View File

@ -407,7 +407,23 @@ pre {
text-align: left;
}
.example {
td:first-child {
background-color: #fff !important;
}
td:last-child {
background-color: #f8faff !important;
}
h5 {
padding-top: 5px;
padding-left: 10px;
}
pre {
background-color: unset;
.js {
background-color: #f0f0f4;
}
}
}
footer {
background-color: #eee;

View File

@ -135,6 +135,23 @@
<td></td>
<td>SKU number</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.system().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
manufacturer: 'Apple Inc.',
model: 'MacBookPro13,2',
version: '1.0',
serial: 'C01xxxxxxxx',
uuid: 'F87654-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
sku: 'Mac-99878xxxx...'
}
</pre>
</tr>
<tr>
<td>si.bios(cb)</td>
<td>{...}</td>
@ -185,6 +202,20 @@
<td></td>
<td>revision</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.bios().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
vendor: 'American Megatrends Inc.',
version: 'P4.20',
releaseDate: '2019-09-05',
revision: '5.13'
}</pre>
</tr>
<tr>
<td>si.baseboard(cb)</td>
<td>{...}</td>
@ -245,6 +276,21 @@
<td></td>
<td>asset tag</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.baseboard().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
manufacturer: 'ASRock',
model: 'H310M-STX',
version: '',
serial: 'C80-xxxxxxxxxxx',
assetTag: ''
}</pre>
</tr>
<tr>
<td>si.chassis(cb)</td>
<td>{...}</td>
@ -325,6 +371,23 @@
<td></td>
<td>SKU number</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.chassis().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
manufacturer: 'Apple Inc.',
model: 'MacBookPro13,2',
type: '',
version: '1.0',
serial: 'C01xxxxxxxx',
assetTag: 'Mac-99878xxxx...',
sku: ''
}</pre>
</tr>
</tbody>
</table>
</div>

View File

@ -1132,8 +1132,8 @@ function networkConnections(callback) {
let cmd = 'export LC_ALL=C; netstat -tunap | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL';
if (_freebsd || _openbsd || _netbsd) cmd = 'export LC_ALL=C; netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL';
exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
if (!error) {
let lines = stdout.toString().split('\n');
if (!error && (lines.length > 1 || lines[0] != '')) {
lines.forEach(function (line) {
line = line.replace(/ +/g, ' ').split(' ');
if (line.length >= 7) {

View File

@ -492,9 +492,17 @@ function versions(callback) {
exec('mysql -V', function (error, stdout) {
if (!error) {
let mysql = stdout.toString().split('\n')[0] || '';
mysql = (mysql.toLowerCase().split(',')[0] || '').trim();
mysql = mysql.toLowerCase();
if (mysql.indexOf(',') > -1) {
mysql = (mysql.split(',')[0] || '').trim();
const parts = mysql.split(' ');
result.mysql = (parts[parts.length - 1] || '').trim();
} else {
if (mysql.indexOf(' ver ') > -1) {
mysql = mysql.split(' ver ')[1];
result.mysql = mysql.split(' ')[0];
}
}
}
functionProcessed();
});

View File

@ -135,7 +135,10 @@ function services(srv, callback) {
let singleSrv = allSrv.filter(item => { return item.name === srv; });
const pids = [];
for (const p of ps) {
pids.push(p.trim().split(' ')[2]);
const pid = p.trim().split(' ')[2];
if (pid) {
pids.push(parseInt(pid, 10));
}
}
result.push({
name: srv,

View File

@ -1,6 +1,6 @@
{
"name": "systeminformation",
"version": "4.21.1",
"version": "4.21.3",
"description": "Simple system and OS information library",
"license": "MIT",
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",
@ -74,6 +74,10 @@
"type": "git",
"url": "https://github.com/sebhildebrandt/systeminformation.git"
},
"funding": {
"type": "Buy me a coffee",
"url": "https://www.buymeacoffee.com/systeminfo"
},
"os": [
"darwin",
"linux",