systeminformation 5.30.8 → 5.31.0
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/README.md +2 -2
- package/lib/filesystem.js +55 -1
- package/lib/osinfo.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -539,8 +539,8 @@ Full function reference with examples can be found at
|
|
|
539
539
|
| | [0].serialNum | X | | X | X | | serial number |
|
|
540
540
|
| | [0].interfaceType | X | | X | X | | SATA, PCIe, ... |
|
|
541
541
|
| | [0].smartStatus | X | | X | X | | S.M.A.R.T Status (see Known Issues) |
|
|
542
|
-
| | [0].temperature | X | |
|
|
543
|
-
| | [0].smartData | X | |
|
|
542
|
+
| | [0].temperature | X | | X | X | | S.M.A.R.T temperature |
|
|
543
|
+
| | [0].smartData | X | | X | X | | full S.M.A.R.T data from smartctl<br>requires at least smartmontools 7.0 |
|
|
544
544
|
| si.blockDevices(cb) | [{...}] | X | | X | X | | returns array of disks, partitions,<br>raids and roms |
|
|
545
545
|
| | [0].name | X | | X | X | | name |
|
|
546
546
|
| | [0].type | X | | X | X | | type |
|
package/lib/filesystem.js
CHANGED
|
@@ -1349,6 +1349,7 @@ function diskLayout(callback) {
|
|
|
1349
1349
|
resolve(result);
|
|
1350
1350
|
}
|
|
1351
1351
|
if (_darwin) {
|
|
1352
|
+
let cmdFullSmart = '';
|
|
1352
1353
|
exec('system_profiler SPSerialATADataType SPNVMeDataType SPUSBDataType', { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
1353
1354
|
if (!error) {
|
|
1354
1355
|
// split by type:
|
|
@@ -1420,6 +1421,7 @@ function diskLayout(callback) {
|
|
|
1420
1421
|
BSDName: BSDName
|
|
1421
1422
|
});
|
|
1422
1423
|
cmd = cmd + 'printf "\n' + BSDName + '|"; diskutil info /dev/' + BSDName + ' | grep SMART;';
|
|
1424
|
+
cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${BSDName};`;
|
|
1423
1425
|
}
|
|
1424
1426
|
}
|
|
1425
1427
|
});
|
|
@@ -1475,6 +1477,7 @@ function diskLayout(callback) {
|
|
|
1475
1477
|
BSDName: BSDName
|
|
1476
1478
|
});
|
|
1477
1479
|
cmd = `${cmd}printf "\n${BSDName}|"; diskutil info /dev/${BSDName} | grep SMART;`;
|
|
1480
|
+
cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${BSDName};`;
|
|
1478
1481
|
}
|
|
1479
1482
|
}
|
|
1480
1483
|
});
|
|
@@ -1527,13 +1530,64 @@ function diskLayout(callback) {
|
|
|
1527
1530
|
BSDName: BSDName
|
|
1528
1531
|
});
|
|
1529
1532
|
cmd = cmd + 'printf "\n' + BSDName + '|"; diskutil info /dev/' + BSDName + ' | grep SMART;';
|
|
1533
|
+
cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${BSDName};`;
|
|
1530
1534
|
}
|
|
1531
1535
|
}
|
|
1532
1536
|
});
|
|
1533
1537
|
} catch {
|
|
1534
1538
|
util.noop();
|
|
1535
1539
|
}
|
|
1536
|
-
|
|
1540
|
+
// check S.M.A.R.T. status
|
|
1541
|
+
if (cmdFullSmart) {
|
|
1542
|
+
exec(cmdFullSmart, { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
1543
|
+
try {
|
|
1544
|
+
const data = JSON.parse(`[${stdout}]`);
|
|
1545
|
+
data.forEach((disk) => {
|
|
1546
|
+
const diskBSDName = disk.smartctl.argv[disk.smartctl.argv.length - 1];
|
|
1547
|
+
|
|
1548
|
+
for (let i = 0; i < result.length; i++) {
|
|
1549
|
+
if (result[i].BSDName === diskBSDName) {
|
|
1550
|
+
result[i].smartStatus = disk.smart_status.passed ? 'Ok' : disk.smart_status.passed === false ? 'Predicted Failure' : 'unknown';
|
|
1551
|
+
if (disk.temperature && disk.temperature.current) {
|
|
1552
|
+
result[i].temperature = disk.temperature.current;
|
|
1553
|
+
}
|
|
1554
|
+
result[i].smartData = disk;
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
});
|
|
1558
|
+
commitResult(result);
|
|
1559
|
+
} catch (e) {
|
|
1560
|
+
if (cmd) {
|
|
1561
|
+
cmd = cmd + 'printf "\n"';
|
|
1562
|
+
exec(cmd, { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
1563
|
+
const lines = stdout.toString().split('\n');
|
|
1564
|
+
lines.forEach((line) => {
|
|
1565
|
+
if (line) {
|
|
1566
|
+
const parts = line.split('|');
|
|
1567
|
+
if (parts.length === 2) {
|
|
1568
|
+
const BSDName = parts[0];
|
|
1569
|
+
parts[1] = parts[1].trim();
|
|
1570
|
+
const parts2 = parts[1].split(':');
|
|
1571
|
+
if (parts2.length === 2) {
|
|
1572
|
+
parts2[1] = parts2[1].trim();
|
|
1573
|
+
const status = parts2[1].toLowerCase();
|
|
1574
|
+
for (let i = 0; i < result.length; i++) {
|
|
1575
|
+
if (result[i].BSDName === BSDName) {
|
|
1576
|
+
result[i].smartStatus = status === 'passed' ? 'Ok' : status === 'failed!' ? 'Predicted Failure' : 'unknown';
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
});
|
|
1583
|
+
commitResult(result);
|
|
1584
|
+
});
|
|
1585
|
+
} else {
|
|
1586
|
+
commitResult(result);
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
});
|
|
1590
|
+
} else if (cmd) {
|
|
1537
1591
|
cmd = cmd + 'printf "\n"';
|
|
1538
1592
|
exec(cmd, { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
1539
1593
|
const lines = stdout.toString().split('\n');
|
package/lib/osinfo.js
CHANGED
|
@@ -769,9 +769,14 @@ function versions(apps, callback) {
|
|
|
769
769
|
if (_linux) {
|
|
770
770
|
exec('locate bin/postgres', (error, stdout) => {
|
|
771
771
|
if (!error) {
|
|
772
|
-
const
|
|
772
|
+
const safePath = /^[a-zA-Z0-9/_.-]+$/;
|
|
773
|
+
const postgresqlBin = stdout
|
|
774
|
+
.toString()
|
|
775
|
+
.split('\n')
|
|
776
|
+
.filter((p) => safePath.test(p.trim()))
|
|
777
|
+
.sort();
|
|
773
778
|
if (postgresqlBin.length) {
|
|
774
|
-
|
|
779
|
+
execFile(postgresqlBin[postgresqlBin.length - 1], ['-V'], (error, stdout) => {
|
|
775
780
|
if (!error) {
|
|
776
781
|
const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
|
|
777
782
|
appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.31.0",
|
|
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)",
|