Add message if the model is known in smart DB

This commit is contained in:
Jeremy Gardais 2020-02-21 10:24:23 +01:00
parent f433389f0e
commit aa0a2359a5
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 13 additions and 0 deletions

View File

@ -113,8 +113,11 @@ if test -s /tmp/dscan; then
### Get SMART Health Status and return code
DRES=$(/usr/sbin/smartctl -H -d "${TYPE}" -n standby "${DISK}")
DCODE=$?
### 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|^$")
### Check if the disk is known from smartmontools database
DDRIVEDB=$(smartctl -d "${TYPE}" -P show "${DISK}")
fi
## Test health status
@ -136,6 +139,15 @@ if test -s /tmp/dscan; then
COLOR="3&green"
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
if ! grep -q "${DID}" /tmp/dres; then
## For summary
@ -146,6 +158,7 @@ if test -s /tmp/dscan; then
echo "${COLOR} $DISK ${TYPE}" | cut -c2-
echo ""
echo "$DRES" | grep -v -E "^smartctl|^Copyright|^$|^==="
echo "${DDRIVEDB_MSG}"
echo "${DINFO}"
echo "------------------------------------------------------------"
echo ""