Only display smart DB message for supported device

This commit is contained in:
Jeremy Gardais 2020-02-21 11:04:10 +01:00
parent aa0a2359a5
commit 2e114b4179
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 10 additions and 11 deletions

View File

@ -108,6 +108,7 @@ if test -s /tmp/dscan; then
### Still try to display informations about unsupported device (eg. RAID controller,…) ### Still try to display informations about unsupported device (eg. RAID controller,…)
DID="unsupported-${DISK}" 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.") 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=""
else else
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: SMART seems fully supported, proceed normally." [ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: SMART seems fully supported, proceed normally."
### Get SMART Health Status and return code ### Get SMART Health Status and return code
@ -116,8 +117,15 @@ if test -s /tmp/dscan; then
### Get disk's serial number and informations ### Get disk's serial number and informations
DID=$(smartctl -i -d "${TYPE}" "${DISK}" | awk '/.erial .umber:/ { print $NF }') DID=$(smartctl -i -d "${TYPE}" "${DISK}" | awk '/.erial .umber:/ { print $NF }')
DINFO=$(smartctl -i -d "${TYPE}" "${DISK}" | grep -v -E "^smartctl|^Copyright|^$") DINFO=$(smartctl -i -d "${TYPE}" "${DISK}" | grep -v -E "^smartctl|^Copyright|^$")
### Check if the disk is known from smartmontools database ## If the model of the disk is known from smartmontools database
DDRIVEDB=$(smartctl -d "${TYPE}" -P show "${DISK}") 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:
https://github.com/skazi0/xymon-plugins/blob/master/client/ext/smart"
else
DDRIVEDB_MSG="&clear Device is unknown or not complete in smartmontools database. Please take a look to the FAQ:
https://www.smartmontools.org/wiki/FAQ#SmartmontoolsDatabase"
fi
fi fi
## Test health status ## Test health status
@ -139,15 +147,6 @@ if test -s /tmp/dscan; then
COLOR="3&green" COLOR="3&green"
fi fi
## If the model of the disk is known from smartmontools database
if "${DDRIVEDB}" | 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:
https://github.com/skazi0/xymon-plugins/blob/master/client/ext/smart"
else
DDRIVEDB_MSG="&clear Device is unknown or not complete in smartmontools database. Please take a look to the FAQ:
https://www.smartmontools.org/wiki/FAQ#SmartmontoolsDatabase"
fi
## Avoid duplicate device ## Avoid duplicate device
if ! grep -q "${DID}" /tmp/dres; then if ! grep -q "${DID}" /tmp/dres; then
## For summary ## For summary