diff --git a/xymon/plugins/client/ext/smart b/xymon/plugins/client/ext/smart index 5fe86d7..305db70 100755 --- a/xymon/plugins/client/ext/smart +++ b/xymon/plugins/client/ext/smart @@ -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 ""