systeminformation 5.11.21 → 5.11.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cpu.js +1 -1
- package/lib/filesystem.js +26 -8
- package/lib/graphics.js +6 -2
- package/lib/index.d.ts +5 -2
- package/lib/osinfo.js +1 -0
- package/lib/processes.js +62 -28
- package/lib/system.js +4 -2
- package/lib/util.js +32 -27
- package/package.json +1 -1
package/lib/cpu.js
CHANGED
|
@@ -1039,7 +1039,7 @@ function cpuTemperature(callback) {
|
|
|
1039
1039
|
util.noop();
|
|
1040
1040
|
}
|
|
1041
1041
|
|
|
1042
|
-
const cmd = 'for mon in /sys/class/hwmon/hwmon*; do for label in "$mon"/temp*_label; do if [ -f $label ]; then value=$
|
|
1042
|
+
const cmd = 'for mon in /sys/class/hwmon/hwmon*; do for label in "$mon"/temp*_label; do if [ -f $label ]; then value=${label%_*}_input; echo $(cat "$label")___$(cat "$value"); fi; done; done;';
|
|
1043
1043
|
try {
|
|
1044
1044
|
exec(cmd, function (error, stdout) {
|
|
1045
1045
|
stdout = stdout.toString();
|
package/lib/filesystem.js
CHANGED
|
@@ -50,8 +50,28 @@ function fsSize(callback) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
function isLinuxTmpFs(fs) {
|
|
53
|
-
const linuxTmpFileSystems = ['rootfs', 'unionfs', 'squashfs', 'cramfs', 'initrd', 'initramfs', 'devtmpfs', 'tmpfs', 'udev', 'devfs', 'specfs', 'type'];
|
|
54
|
-
|
|
53
|
+
const linuxTmpFileSystems = ['rootfs', 'unionfs', 'squashfs', 'cramfs', 'initrd', 'initramfs', 'devtmpfs', 'tmpfs', 'udev', 'devfs', 'specfs', 'type', 'appimaged'];
|
|
54
|
+
let result = false;
|
|
55
|
+
linuxTmpFileSystems.forEach(linuxFs => {
|
|
56
|
+
if (fs.toLowerCase().indexOf(linuxFs) >= 0) result = true;
|
|
57
|
+
});
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function filterLines(stdout) {
|
|
62
|
+
let lines = stdout.toString().split('\n');
|
|
63
|
+
if (stdout.toString().toLowerCase().indexOf('filesystem')) {
|
|
64
|
+
let removeLines = 0;
|
|
65
|
+
for (let i = 0; i < lines.length; i++) {
|
|
66
|
+
if (line[i] && lines[i].toLowerCase().startsWith('filesystem')) {
|
|
67
|
+
removeLines = i;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
for (let i = 0; i < removeLines; i++) {
|
|
71
|
+
lines.shift();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return lines;
|
|
55
75
|
}
|
|
56
76
|
|
|
57
77
|
function parseDf(lines) {
|
|
@@ -104,10 +124,9 @@ function fsSize(callback) {
|
|
|
104
124
|
if (_linux) { cmd = 'df -lkPTx squashfs'; } // cmd = 'df -lkPTx squashfs | grep -E "^/|^.\\:"';
|
|
105
125
|
if (_freebsd || _openbsd || _netbsd) { cmd = 'df -lkPT'; }
|
|
106
126
|
exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
data = parseDf(lines);
|
|
127
|
+
let lines = filterLines(stdout);
|
|
128
|
+
data = parseDf(lines);
|
|
129
|
+
if (!error || data.length) {
|
|
111
130
|
if (callback) {
|
|
112
131
|
callback(data);
|
|
113
132
|
}
|
|
@@ -115,8 +134,7 @@ function fsSize(callback) {
|
|
|
115
134
|
} else {
|
|
116
135
|
exec('df -kPT', { maxBuffer: 1024 * 1024 }, function (error, stdout) {
|
|
117
136
|
if (!error) {
|
|
118
|
-
let lines = stdout
|
|
119
|
-
if (lines && lines[0] && lines[0].toLowerCase().startsWith('filesystem')) { lines.shift(); }
|
|
137
|
+
let lines = filterLines(stdout);
|
|
120
138
|
data = parseDf(lines);
|
|
121
139
|
}
|
|
122
140
|
if (callback) {
|
package/lib/graphics.js
CHANGED
|
@@ -429,7 +429,7 @@ function graphics(callback) {
|
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
const gpus = stdout.split('\n').filter(Boolean);
|
|
432
|
-
|
|
432
|
+
let results = gpus.map(gpu => {
|
|
433
433
|
const splittedData = gpu.split(', ').map(value => value.includes('N/A') ? undefined : value);
|
|
434
434
|
if (splittedData.length === 16) {
|
|
435
435
|
return {
|
|
@@ -450,9 +450,13 @@ function graphics(callback) {
|
|
|
450
450
|
clockCore: safeParseNumber(splittedData[14]),
|
|
451
451
|
clockMemory: safeParseNumber(splittedData[15]),
|
|
452
452
|
};
|
|
453
|
+
} else {
|
|
454
|
+
return {};
|
|
453
455
|
}
|
|
454
456
|
});
|
|
455
|
-
|
|
457
|
+
results = results.filter((item) => {
|
|
458
|
+
return ('pciBus' in item);
|
|
459
|
+
});
|
|
456
460
|
return results;
|
|
457
461
|
}
|
|
458
462
|
|
package/lib/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export namespace Systeminformation {
|
|
|
7
7
|
// 1. General
|
|
8
8
|
|
|
9
9
|
interface TimeData {
|
|
10
|
-
current:
|
|
11
|
-
uptime:
|
|
10
|
+
current: number;
|
|
11
|
+
uptime: number;
|
|
12
12
|
timezone: string;
|
|
13
13
|
timezoneName: string;
|
|
14
14
|
}
|
|
@@ -988,3 +988,6 @@ export function getDynamicData(srv?: string, iface?: string, cb?: (data: any) =>
|
|
|
988
988
|
export function getAllData(srv?: string, iface?: string, cb?: (data: any) => any): Promise<any>;
|
|
989
989
|
export function get(valuesObject: any, cb?: (data: any) => any): Promise<any>;
|
|
990
990
|
export function observe(valuesObject: any, interval: number, cb?: (data: any) => any): number;
|
|
991
|
+
|
|
992
|
+
export function powerShellStart(): void;
|
|
993
|
+
export function powerShellRelease(): void;
|
package/lib/osinfo.js
CHANGED
|
@@ -307,6 +307,7 @@ function osInfo(callback) {
|
|
|
307
307
|
result.codename = (result.release.indexOf('10.15') > -1 ? 'macOS Catalina' : result.codename);
|
|
308
308
|
result.codename = (result.release.startsWith('11.') ? 'macOS Big Sur' : result.codename);
|
|
309
309
|
result.codename = (result.release.startsWith('12.') ? 'macOS Monterey' : result.codename);
|
|
310
|
+
result.codename = (result.release.startsWith('13.') ? 'macOS Ventura' : result.codename);
|
|
310
311
|
result.uefi = true;
|
|
311
312
|
result.codepage = util.getCodepage();
|
|
312
313
|
if (callback) {
|
package/lib/processes.js
CHANGED
|
@@ -88,6 +88,25 @@ function parseTimeUnix(time) {
|
|
|
88
88
|
return result;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
function parseElapsedTime(etime) {
|
|
92
|
+
let current = new Date();
|
|
93
|
+
current = new Date(current.getTime() - current.getTimezoneOffset() * 60000);
|
|
94
|
+
|
|
95
|
+
const elapsed = etime.split('-');
|
|
96
|
+
|
|
97
|
+
const timeIndex = elapsed.length - 1;
|
|
98
|
+
const days = timeIndex > 0 ? parseInt(elapsed[timeIndex - 1]) : 0;
|
|
99
|
+
|
|
100
|
+
const timeStr = elapsed[timeIndex].split(':');
|
|
101
|
+
const hours = timeStr.length === 3 ? parseInt(timeStr[0] || 0) : 0;
|
|
102
|
+
const mins = parseInt(timeStr[timeStr.length === 3 ? 1 : 0] || 0);
|
|
103
|
+
const secs = parseInt(timeStr[timeStr.length === 3 ? 2 : 1] || 0);
|
|
104
|
+
const ms = (((((days * 24 + hours) * 60) + mins) * 60 + secs) * 1000);
|
|
105
|
+
|
|
106
|
+
const res = new Date(current.getTime() - ms);
|
|
107
|
+
return res.toISOString().substring(0, 10) + ' ' + res.toISOString().substring(11, 19);
|
|
108
|
+
}
|
|
109
|
+
|
|
91
110
|
// --------------------------
|
|
92
111
|
// PS - services
|
|
93
112
|
// pass a comma separated string with services to check (mysql, apache, postgresql, ...)
|
|
@@ -550,7 +569,7 @@ function processes(callback) {
|
|
|
550
569
|
checkColumn(7);
|
|
551
570
|
const nice = parseInt(line.substring(parsedhead[7].from + offset, parsedhead[7].to + offset2)) || 0;
|
|
552
571
|
checkColumn(8);
|
|
553
|
-
const started = parseTimeUnix(line.substring(parsedhead[8].from + offset, parsedhead[8].to + offset2).trim());
|
|
572
|
+
const started = !_sunos ? parseElapsedTime(line.substring(parsedhead[8].from + offset, parsedhead[8].to + offset2).trim()) : parseTimeUnix(line.substring(parsedhead[8].from + offset, parsedhead[8].to + offset2).trim());
|
|
554
573
|
checkColumn(9);
|
|
555
574
|
let state = line.substring(parsedhead[9].from + offset, parsedhead[9].to + offset2).trim();
|
|
556
575
|
state = (state[0] === 'R' ? 'running' : (state[0] === 'S' ? 'sleeping' : (state[0] === 'T' ? 'stopped' : (state[0] === 'W' ? 'paging' : (state[0] === 'X' ? 'dead' : (state[0] === 'Z' ? 'zombie' : ((state[0] === 'D' || state[0] === 'U') ? 'blocked' : 'unknown')))))));
|
|
@@ -567,33 +586,48 @@ function processes(callback) {
|
|
|
567
586
|
if (fullcommand.substr(fullcommand.length - 1) === ']') { fullcommand = fullcommand.slice(0, -1); }
|
|
568
587
|
if (fullcommand.substr(0, 1) === '[') { command = fullcommand.substring(1); }
|
|
569
588
|
else {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
tmpCommand = tmpCommand.substr(lastSlashPos + 1);
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
if (firstPos === 10000 && tmpCommand.indexOf(' ') > -1) {
|
|
585
|
-
const parts = tmpCommand.split(' ');
|
|
586
|
-
if (fs.existsSync(path.join(cmdPath, parts[0]))) {
|
|
587
|
-
command = parts.shift();
|
|
588
|
-
params = (parts.join(' ') + ' ' + tmpParams).trim();
|
|
589
|
+
const p1 = fullcommand.indexOf('(');
|
|
590
|
+
const p2 = fullcommand.indexOf(')');
|
|
591
|
+
const p3 = fullcommand.indexOf('/');
|
|
592
|
+
const p4 = fullcommand.indexOf(':');
|
|
593
|
+
if (p1 < p2 && p1 < p3 && p3 < p2) {
|
|
594
|
+
command = fullcommand.split(' ')[0];
|
|
595
|
+
command = command.replace(/:/g, '');
|
|
596
|
+
} else {
|
|
597
|
+
if (p4 > 0 && (p3 === -1 || p3 > 3)) {
|
|
598
|
+
command = fullcommand.split(' ')[0];
|
|
599
|
+
command = command.replace(/:/g, '');
|
|
589
600
|
} else {
|
|
590
|
-
|
|
591
|
-
|
|
601
|
+
// try to figure out where parameter starts
|
|
602
|
+
let firstParamPos = fullcommand.indexOf(' -');
|
|
603
|
+
let firstParamPathPos = fullcommand.indexOf(' /');
|
|
604
|
+
firstParamPos = (firstParamPos >= 0 ? firstParamPos : 10000);
|
|
605
|
+
firstParamPathPos = (firstParamPathPos >= 0 ? firstParamPathPos : 10000);
|
|
606
|
+
const firstPos = Math.min(firstParamPos, firstParamPathPos);
|
|
607
|
+
let tmpCommand = fullcommand.substr(0, firstPos);
|
|
608
|
+
const tmpParams = fullcommand.substr(firstPos);
|
|
609
|
+
const lastSlashPos = tmpCommand.lastIndexOf('/');
|
|
610
|
+
if (lastSlashPos >= 0) {
|
|
611
|
+
cmdPath = tmpCommand.substr(0, lastSlashPos);
|
|
612
|
+
tmpCommand = tmpCommand.substr(lastSlashPos + 1);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
if (firstPos === 10000 && tmpCommand.indexOf(' ') > -1) {
|
|
616
|
+
const parts = tmpCommand.split(' ');
|
|
617
|
+
if (fs.existsSync(path.join(cmdPath, parts[0]))) {
|
|
618
|
+
command = parts.shift();
|
|
619
|
+
params = (parts.join(' ') + ' ' + tmpParams).trim();
|
|
620
|
+
} else {
|
|
621
|
+
command = tmpCommand.trim();
|
|
622
|
+
params = tmpParams.trim();
|
|
623
|
+
}
|
|
624
|
+
} else {
|
|
625
|
+
command = tmpCommand.trim();
|
|
626
|
+
params = tmpParams.trim();
|
|
627
|
+
}
|
|
592
628
|
}
|
|
593
|
-
} else {
|
|
594
|
-
command = tmpCommand.trim();
|
|
595
|
-
params = tmpParams.trim();
|
|
596
629
|
}
|
|
630
|
+
|
|
597
631
|
}
|
|
598
632
|
|
|
599
633
|
return ({
|
|
@@ -693,9 +727,9 @@ function processes(callback) {
|
|
|
693
727
|
|
|
694
728
|
if ((_processes_cpu.ms && Date.now() - _processes_cpu.ms >= 500) || _processes_cpu.ms === 0) {
|
|
695
729
|
if (_linux || _freebsd || _openbsd || _netbsd || _darwin || _sunos) {
|
|
696
|
-
if (_linux) { cmd = 'export LC_ALL=C; ps -axo pid:11,ppid:11,pcpu:6,pmem:6,pri:5,vsz:11,rss:11,ni:5,
|
|
697
|
-
if (_freebsd || _openbsd || _netbsd) { cmd = 'export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,
|
|
698
|
-
if (_darwin) { cmd = 'ps -axo pid,ppid,pcpu,pmem,pri,vsz=
|
|
730
|
+
if (_linux) { cmd = 'export LC_ALL=C; ps -axo pid:11,ppid:11,pcpu:6,pmem:6,pri:5,vsz:11,rss:11,ni:5,etime:30,state:5,tty:15,user:20,command; unset LC_ALL'; }
|
|
731
|
+
if (_freebsd || _openbsd || _netbsd) { cmd = 'export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,etime,state,tty,user,command; unset LC_ALL'; }
|
|
732
|
+
if (_darwin) { cmd = 'ps -axo pid,ppid,pcpu,pmem,pri,vsz=temp_title_1,rss=temp_title_2,nice,etime=temp_title_3,state,tty,user,command -r'; }
|
|
699
733
|
if (_sunos) { cmd = 'ps -Ao pid,ppid,pcpu,pmem,pri,vsz,rss,nice,stime,s,tty,user,comm'; }
|
|
700
734
|
exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
|
|
701
735
|
if (!error && stdout.toString().trim()) {
|
package/lib/system.js
CHANGED
|
@@ -662,8 +662,10 @@ function baseboard(callback) {
|
|
|
662
662
|
if (_windows) {
|
|
663
663
|
try {
|
|
664
664
|
const workload = [];
|
|
665
|
+
const win10plus = parseInt(os.release()) >= 10;
|
|
666
|
+
const maxCapacityAttribute = win10plus ? 'MaxCapacityEx' : 'MaxCapacity';
|
|
665
667
|
workload.push(util.powerShell('Get-WmiObject Win32_baseboard | select Model,Manufacturer,Product,Version,SerialNumber,PartNumber,SKU | fl'));
|
|
666
|
-
workload.push(util.powerShell(
|
|
668
|
+
workload.push(util.powerShell(`Get-WmiObject Win32_physicalmemoryarray | select ${maxCapacityAttribute}, MemoryDevices | fl`));
|
|
667
669
|
util.promiseAll(
|
|
668
670
|
workload
|
|
669
671
|
).then(data => {
|
|
@@ -683,7 +685,7 @@ function baseboard(callback) {
|
|
|
683
685
|
|
|
684
686
|
// memphysical
|
|
685
687
|
lines = data.results[1] ? data.results[1].toString().split('\r\n') : [''];
|
|
686
|
-
result.memMax = util.toInt(util.getValue(lines,
|
|
688
|
+
result.memMax = util.toInt(util.getValue(lines, maxCapacityAttribute, ':')) * (win10plus ? 1024 : 1) || null;
|
|
687
689
|
result.memSlots = util.toInt(util.getValue(lines, 'MemoryDevices', ':')) || null;
|
|
688
690
|
|
|
689
691
|
if (callback) { callback(result); }
|
package/lib/util.js
CHANGED
|
@@ -396,42 +396,47 @@ function powerShellProceedResults(data) {
|
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
function powerShellStart() {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
if (_psChild && _psChild.pid) {
|
|
407
|
-
_psPersistent = true;
|
|
408
|
-
_psChild.stdout.on('data', function (data) {
|
|
409
|
-
_psResult = _psResult + data.toString('utf8');
|
|
410
|
-
if (data.indexOf(_psCmdSeperator) >= 0) {
|
|
411
|
-
powerShellProceedResults(_psResult);
|
|
412
|
-
_psResult = '';
|
|
413
|
-
}
|
|
414
|
-
});
|
|
415
|
-
_psChild.stderr.on('data', function () {
|
|
416
|
-
powerShellProceedResults(_psResult + _psError);
|
|
417
|
-
});
|
|
418
|
-
_psChild.on('error', function () {
|
|
419
|
-
powerShellProceedResults(_psResult + _psError);
|
|
420
|
-
});
|
|
421
|
-
_psChild.on('close', function () {
|
|
422
|
-
_psChild.kill();
|
|
399
|
+
if (!_psChild) {
|
|
400
|
+
_psChild = spawn('powershell.exe', ['-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], {
|
|
401
|
+
stdio: 'pipe',
|
|
402
|
+
windowsHide: true,
|
|
403
|
+
maxBuffer: 1024 * 20000,
|
|
404
|
+
encoding: 'UTF-8',
|
|
405
|
+
env: util._extend({}, process.env, { LANG: 'en_US.UTF-8' })
|
|
423
406
|
});
|
|
407
|
+
if (_psChild && _psChild.pid) {
|
|
408
|
+
_psPersistent = true;
|
|
409
|
+
_psChild.stdout.on('data', function (data) {
|
|
410
|
+
_psResult = _psResult + data.toString('utf8');
|
|
411
|
+
if (data.indexOf(_psCmdSeperator) >= 0) {
|
|
412
|
+
powerShellProceedResults(_psResult);
|
|
413
|
+
_psResult = '';
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
_psChild.stderr.on('data', function () {
|
|
417
|
+
powerShellProceedResults(_psResult + _psError);
|
|
418
|
+
});
|
|
419
|
+
_psChild.on('error', function () {
|
|
420
|
+
powerShellProceedResults(_psResult + _psError);
|
|
421
|
+
});
|
|
422
|
+
_psChild.on('close', function () {
|
|
423
|
+
_psChild.kill();
|
|
424
|
+
});
|
|
425
|
+
}
|
|
424
426
|
}
|
|
425
427
|
}
|
|
426
428
|
|
|
427
429
|
function powerShellRelease() {
|
|
428
430
|
try {
|
|
429
|
-
_psChild
|
|
430
|
-
|
|
431
|
-
|
|
431
|
+
if (_psChild) {
|
|
432
|
+
_psChild.stdin.write('exit' + os.EOL);
|
|
433
|
+
_psChild.stdin.end();
|
|
434
|
+
_psPersistent = false;
|
|
435
|
+
}
|
|
432
436
|
} catch (e) {
|
|
433
437
|
_psChild.kill();
|
|
434
438
|
}
|
|
439
|
+
_psChild = null;
|
|
435
440
|
}
|
|
436
441
|
|
|
437
442
|
function powerShell(cmd) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.11.
|
|
3
|
+
"version": "5.11.24",
|
|
4
4
|
"description": "Advanced, lightweight system and OS information library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",
|