diff --git a/xymon/plugins/client/ext/smart b/xymon/plugins/client/ext/smart index 4e416eb..5fe86d7 100755 --- a/xymon/plugins/client/ext/smart +++ b/xymon/plugins/client/ext/smart @@ -108,6 +108,7 @@ if test -s /tmp/dscan; then ### Still try to display informations about unsupported device (eg. RAID controller,…) 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="" 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 @@ -116,8 +117,15 @@ 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|^$") - ### Check if the disk is known from smartmontools database - DDRIVEDB=$(smartctl -d "${TYPE}" -P show "${DISK}") + ## 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: +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 ## Test health status @@ -139,15 +147,6 @@ 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