Build a list of device known from smartmontools DB

And compatible with selftest logging.
This file can next be used by an advanced script.
This commit is contained in:
Jeremy Gardais 2020-03-04 10:56:36 +01:00
parent 60217f1eec
commit ac0d619cd7
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 9 additions and 0 deletions

View File

@ -35,6 +35,9 @@ plugin_name=$(basename "${0}")
plugin_result="${XYMONTMP}/${MACHINEDOTS}.smartoverall.plugin_result" plugin_result="${XYMONTMP}/${MACHINEDOTS}.smartoverall.plugin_result"
plugin_state="${XYMONTMP}/${MACHINEDOTS}.smartoverall.plugin_state" plugin_state="${XYMONTMP}/${MACHINEDOTS}.smartoverall.plugin_state"
device_list="${XYMONTMP}/${MACHINEDOTS}.smartoverall.dscan" device_list="${XYMONTMP}/${MACHINEDOTS}.smartoverall.dscan"
## List of devices known from the smartmontools base and compatible with test logging
## This file might be used by a more advanced script such as skazi0's one
drivedb_list="${XYMONTMP}/${MACHINEDOTS}.smart.drivedb.list"
# ]]] # ]]]
@ -112,6 +115,7 @@ choose_correct_type() {
true > "${plugin_result}" true > "${plugin_result}"
true > "${plugin_state}" true > "${plugin_state}"
true > "${device_list}" true > "${device_list}"
true > "${drivedb_list}"
# Get the list of all available devices # Get the list of all available devices
smartctl --scan >> "${device_list}" smartctl --scan >> "${device_list}"
@ -164,6 +168,11 @@ https://www.smartmontools.org/wiki/FAQ#SmartmontoolsDatabase"
DSELFTEST_MSG="&clear Test logging are not supported:" DSELFTEST_MSG="&clear Test logging are not supported:"
else else
DSELFTEST_MSG="" DSELFTEST_MSG=""
### If the device is also known from smartmontools database
if printf -- '%s' "${DDRIVEDB_MSG}" | grep -q -E -- "green"
then
echo "${DISK}" >> "${drivedb_list}"
fi
fi fi
fi fi