From 4bde7561a6e48ede5a2c39810b473e10f35bcf4f Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Tue, 26 Jan 2021 21:12:40 +0100 Subject: [PATCH] disklayout added temperature (linux) --- README.md | 1 + docs/filesystem.html | 10 ++++++++++ lib/filesystem.js | 9 ++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7538445..933bf1d 100644 --- a/README.md +++ b/README.md @@ -414,6 +414,7 @@ Full function reference with examples can be found at [https://systeminformation | | [0].serialNum | X | | X | X | | serial number | | | [0].interfaceType | X | | | X | | SATA, PCIe, ... | | | [0].smartStatus | X | | X | X | | S.M.A.R.T Status (see Known Issues) | +| | [0].temperature | X | | | | | S.M.A.R.T temperature | | | [0].smartData | X | | | | | full S.M.A.R.T data from smartctl
requires at least smartmontools 7.0 | | si.blockDevices(cb) | [{...}] | X | | X | X | | returns array of disks, partitions,
raids and roms | | | [0].name | X | | X | X | | name | diff --git a/docs/filesystem.html b/docs/filesystem.html index 97f83c4..5c5a7e1 100644 --- a/docs/filesystem.html +++ b/docs/filesystem.html @@ -236,6 +236,16 @@ S.M.A.R.T Status (see Known Issues) + + + [0].temperature + X + + + + + S.M.A.R.T temperature (if available) + [0].smartData diff --git a/lib/filesystem.js b/lib/filesystem.js index caa2bba..2955803 100755 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -819,6 +819,7 @@ function diskLayout(callback) { serialNum: device.serial ? device.serial.trim() : '', interfaceType: interfaceType, smartStatus: 'unknown', + temperature: null, BSDName: BSDName }); cmd += `printf "\n${BSDName}|"; smartctl -H ${BSDName} | grep overall;`; @@ -839,6 +840,9 @@ function diskLayout(callback) { for (let i = 0; i < result.length; i++) { if (result[i].BSDName === diskBSDName) { result[i].smartStatus = (disk.smart_status.passed ? 'Ok' : (disk.smart_status.passed === false ? 'Predicted Failure' : 'unknown')); + if (disk.temperature && disk.temperature.current) { + result[i].temperature = disk.temperature.current; + } result[i].smartData = disk; } } @@ -927,6 +931,7 @@ function diskLayout(callback) { serialNum: util.getValue(lines, 'Serial Number', ':', true).trim(), interfaceType: util.getValue(lines, 'InterfaceType', ':', true).trim(), smartStatus: 'unknown', + temperature: null, BSDName: BSDName }); cmd = cmd + 'printf "\n' + BSDName + '|"; diskutil info /dev/' + BSDName + ' | grep SMART;'; @@ -968,6 +973,7 @@ function diskLayout(callback) { serialNum: util.getValue(lines, 'Serial Number', ':', true).trim(), interfaceType: ('PCIe ' + linkWidth).trim(), smartStatus: 'unknown', + temperature: null, BSDName: BSDName }); cmd = cmd + 'printf "\n' + BSDName + '|"; diskutil info /dev/' + BSDName + ' | grep SMART;'; @@ -1043,7 +1049,8 @@ function diskLayout(callback) { firmwareRevision: util.getValue(lines, 'FirmwareRevision', '=').trim(), serialNum: util.getValue(lines, 'SerialNumber', '=').trim(), interfaceType: util.getValue(lines, 'InterfaceType', '=').trim(), - smartStatus: (status === 'ok' ? 'Ok' : (status === 'degraded' ? 'Degraded' : (status === 'pred fail' ? 'Predicted Failure' : 'Unknown'))) + smartStatus: (status === 'ok' ? 'Ok' : (status === 'degraded' ? 'Degraded' : (status === 'pred fail' ? 'Predicted Failure' : 'Unknown'))), + temperature: null, }); } });