chiark / gitweb /
Allow a subset of checks to be run.
[rcheck] / check.d / disks
diff --git a/check.d/disks b/check.d/disks
deleted file mode 100755 (executable)
index ef36835..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#! /bin/bash
-###
-### Check the health of attached physical disks.
-
-set -e
-if [ ! -x /usr/sbin/smartctl ]; then exit 0; fi
-
-## Build a list of actual disk devices according to their buses.
-disks=
-for p in /sys/class/block/*; do
-  bus=none devtype=none idtype=none
-  while read code assg; do
-    case "$assg" in
-      DEVNAME=*) name=${assg#*=} ;;
-      ID_BUS=*) bus=${assg#*=} ;;
-      DEVTYPE=*) devtype=${assg#*=} ;;
-      ID_TYPE=*) idtype=${assg#*=} ;;
-    esac
-  done <<EOF
-$(udevadm info --query=all --path=$p)
-EOF
-  case "$bus,$devtype,$idtype" in
-    ata,disk,disk | scsi,disk,disk) disks=${disks+$disks }$name ;;
-  esac
-done
-
-## Now go through each disk.
-for disk in $disks; do
-  set +e; smartctl -qsilent $disk; rc=$?; set -e
-  if (( $rc & 2 )); then continue; fi
-
-  if (( $rc & 8 )); then echo "W: SMART reports disk $disk failing"; fi
-
-  smartctl -A $disk |
-  while read id attr flag value worst thresh type upd when raw; do
-    case "$id" in *[!0-9]*) continue ;; ?*) ;; *) continue ;; esac
-    while :; do
-      case "$value" in 0*?) value=${value#0} ;; *) break ;; esac;
-    done
-    while :; do
-      case "$thresh" in 0*?) thresh=${thresh#0} ;; *) break ;; esac;
-    done
-    case "$attr,$raw,$when" in
-      Current_Pending_Sector,*[!0]*,*)
-       echo "W: disk $disk has $raw pending sector(s)"
-       ;;
-      Offline_Uncorrectable,*[!0]*,*)
-       echo "W: disk $disk has $raw offline-uncorrectable sector(s)"
-       ;;
-      *,*,FAILING_NOW)
-       echo "W: disk $disk attribute $attr failing (value = $raw)"
-       ;;
-      *)
-       if (( $value < $thresh )); then
-         echo "I: disk $disk attribute $attr below thresh (value = $raw)"
-       fi
-       ;;
-    esac
-  done
-done