Check if a selftests are recorded
Then display the last 3 or put this disk in error state.
This commit is contained in:
parent
2e114b4179
commit
1bd4079a4e
|
@ -109,6 +109,7 @@ if test -s /tmp/dscan; then
|
|||
DID="unsupported-${DISK}"
|
||||
DINFO=$(smartctl -i -d "${SCANNED_TYPE}" "${DISK}" | grep -v -E "^smartctl|^Copyright|^$" || printf '%s' "Can't get informations due to no SMART support.")
|
||||
DDRIVEDB_MSG=""
|
||||
DSELFTEST=""
|
||||
else
|
||||
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : SMART seems fully supported, proceed normally."
|
||||
### Get SMART Health Status and return code
|
||||
|
@ -117,6 +118,7 @@ if test -s /tmp/dscan; then
|
|||
### Get disk's serial number and informations
|
||||
DID=$(smartctl -i -d "${TYPE}" "${DISK}" | awk '/.erial .umber:/ { print $NF }')
|
||||
DINFO=$(smartctl -i -d "${TYPE}" "${DISK}" | grep -v -E "^smartctl|^Copyright|^$")
|
||||
|
||||
## If the model of the disk is known from smartmontools database
|
||||
if smartctl -d "${TYPE}" -P show "${DISK}" | grep -qi -- "drive found in"; then
|
||||
DDRIVEDB_MSG="&green Device is known in smartmontools database. You might consider using a more advanced plugin such as:
|
||||
|
@ -126,6 +128,15 @@ https://github.com/skazi0/xymon-plugins/blob/master/client/ext/smart"
|
|||
https://www.smartmontools.org/wiki/FAQ#SmartmontoolsDatabase"
|
||||
fi
|
||||
|
||||
DSELFTEST=$(smartctl -d "${TYPE}" -l selftest "${DISK}" | grep -v -E -- "^smartctl|^Copyright|^$")
|
||||
## If no selftest have been recorded
|
||||
if smartctl -d "${TYPE}" -l selftest "${DISK}" | grep -qi -- "No self-tests"; then
|
||||
DSELFTEST_MSG="&red No self-tests recorded:"
|
||||
DCODE="8"
|
||||
else
|
||||
DSELFTEST_MSG=""
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
## Test health status
|
||||
|
@ -159,6 +170,8 @@ https://www.smartmontools.org/wiki/FAQ#SmartmontoolsDatabase"
|
|||
echo "$DRES" | grep -v -E "^smartctl|^Copyright|^$|^==="
|
||||
echo "${DDRIVEDB_MSG}"
|
||||
echo "${DINFO}"
|
||||
echo "${DSELFTEST_MSG}"
|
||||
echo "${DSELFTEST}" | head -n6
|
||||
echo "------------------------------------------------------------"
|
||||
echo ""
|
||||
echo ""
|
||||
|
|
Loading…
Reference in New Issue