check_adptraid.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #! /bin/sh
  2. #
  3. # Modified check_sensors to check the alarm status of an Adaptec 3200S RAID
  4. # controller.
  5. #
  6. # Scott Lambert -- lambert@lambertfam.org
  7. #
  8. # Tested on FreeBSD 4.7 with the adptfbsd_323.tgz package installed. This
  9. # package installs all it's programs into /usr/dpt.
  10. #
  11. PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
  12. PROGNAME=`basename $0`
  13. PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
  14. REVISION=`echo '$Revision: 302 $' | sed -e 's/[^0-9.]//g'`
  15. . $PROGPATH/utils.sh
  16. RAIDUTIL_CMD="/usr/dpt/raidutil -A ?"
  17. print_usage() {
  18. echo "Usage: $PROGNAME"
  19. }
  20. print_help() {
  21. print_revision $PROGNAME $REVISION
  22. echo ""
  23. print_usage
  24. echo ""
  25. echo "This plugin checks alarm status of Adaptec 3200S RAID controller."
  26. echo ""
  27. support
  28. exit 0
  29. }
  30. case "$1" in
  31. --help)
  32. print_help
  33. exit 0
  34. ;;
  35. -h)
  36. print_help
  37. exit 0
  38. ;;
  39. --version)
  40. print_revision $PROGNAME $REVISION
  41. exit 0
  42. ;;
  43. -V)
  44. print_revision $PROGNAME $REVISION
  45. exit 0
  46. ;;
  47. *)
  48. raidutiloutput=`$RAIDUTIL_CMD 2>&1`
  49. status=$?
  50. if test "$1" = "-v" -o "$1" = "--verbose"; then
  51. echo ${raidutiloutput}
  52. fi
  53. if test ${status} -eq 127; then
  54. echo "RAIDUTIL UNKNOWN - command not found (did you install raidutil?)"
  55. exit -1
  56. elif test ${status} -ne 0 ; then
  57. echo "WARNING - raidutil returned state $status"
  58. exit 1
  59. fi
  60. if echo ${raidutiloutput} | egrep On > /dev/null; then
  61. echo RAID CRITICAL - RAID alarm detected!
  62. exit 2
  63. else
  64. echo raid ok
  65. exit 0
  66. fi
  67. ;;
  68. esac