[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Nagios monitor script for gdth RAID controller



One of the new Skolelinux machines have a gdth RAID controller.  I
want to have the status if this controller checked by nagios, but am
not very skilled in writing nagios modules.

Can anyone have a look at this draft script, and let me know what the
exit codes and output must be to have nagios accept it as a monitor
script?  At the moment, it outputs this on maintainer.skolelinux.no:

  Gdth RAID controller 0 volume 0 OK
  Gdth RAID controller 0 volume 1 OK

This is the current script source:

#!/bin/sh
#
# Author: Petter Reinholdtsen
# Date:   2006-05-15
#
# Nagios module to report the RAID status from the gdth linux kernel
# module

RC=0

cd /proc/scsi/gdth/ || exit 3

for controller in *; do
    cat $controller | egrep '^ Number: *[0-9]*.*Status:'|awk '{print $2,$4}' |
      while read num status; do
          if [ ok != $status ] ; then
              echo "Gdth RAID controller $controller volume $num ($status) NOT OK"
              RC=2
          else
              echo "Gdth RAID controller $controller volume $num OK"
          fi
      done
done

exit $RC



Reply to: