disklayout added temperature (linux)

This commit is contained in:
Sebastian Hildebrandt 2021-01-26 21:12:40 +01:00
parent 7a9f10f988
commit 4bde7561a6
3 changed files with 19 additions and 1 deletions

View File

@ -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<br>requires at least smartmontools 7.0 |
| si.blockDevices(cb) | [{...}] | X | | X | X | | returns array of disks, partitions,<br>raids and roms |
| | [0].name | X | | X | X | | name |

View File

@ -236,6 +236,16 @@
<td></td>
<td>S.M.A.R.T Status (see Known Issues)</td>
</tr>
<tr>
<td></td>
<td>[0].temperature</td>
<td>X</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>S.M.A.R.T temperature (if available)</td>
</tr>
<tr>
<td></td>
<td>[0].smartData</td>

View File

@ -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,
});
}
});