cvs commit: src/etc/defaults periodic.conf src/etc/periodic/daily 406.status-gmirror

Harald Schmalzbauer harry at schmalzbauer.de
Mon Jan 16 05:45:45 PST 2006


Am Sonntag, 15. Januar 2006 20:36 CEST schrieb Pawel Jakub Dawidek:
> On Fri, Jan 13, 2006 at 06:07:52PM +0000, Garrett Wollman wrote:
> +> wollman     2006-01-13 18:07:52 UTC
> +>
> +>   FreeBSD src repository
> +>
> +>   Modified files:
> +>     etc/defaults         periodic.conf
> +>   Added files:
> +>     etc/periodic/daily   406.status-gmirror
> +>   Log:
> +>   Add a daily script to show the status of gmirror(8) devices.
>
> Cool, thanks! Maybe you can also prepare periodic script for graid3(8)
> as well?:) Or maybe this one can be made more general?

I already sent him a more general one, I'll paste it here since attachments 
get removed.

-Harry

#!/bin/sh
# Written by Harald Schmalzbauer (harry at schmalzbauer.de), 10/20/05, use it 
at your own risk!

# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/periodic.conf ]
then
    . /etc/defaults/periodic.conf
    source_periodic_confs
fi

if [ "X$daily_status_geom_raid_classes" != "X" ]; then
  echo
  echo "Checking the following GEOM Raid classes:"

  for class in $daily_status_geom_raid_classes; do
    if [ "X`sysctl kern.geom.$class 2>/dev/null`" != "X" ]; then
      classes_present="$classes_present $class"
    fi
  done

  for class in $classes_present; do
    eval ${class}_providers=\"`g$class list | grep "Geom name" | cut -d " " 
-f 3`\"
    if [ "X`eval echo \\$${class}_providers`" != "X" ]; then
      echo "      geom_$class:"
    fi
    for name in `eval echo \\$${class}_providers`; do
      if [ "X`g$class status $name | grep COMPLETE`" = "X" ]; then
        echo "ERROR!!!"
        g$class status $name
        rc=3
      else
        echo "          Provider $name is OK"
      fi
    done
  done
  rc=1
else
  rc=0
fi

exit $rc

And here ist the one for 3ware controllers:

#!/bin/sh
# Written by Harald Schmalzbauer (harry at schmalzbauer.de), 10/20/05, use it 
at your own risk!

# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/periodic.conf ]
then
    . /etc/defaults/periodic.conf
    source_periodic_confs
fi

case "$daily_status_twe_raid_enable" in
    [Yy][Ee][Ss])
	rc=1
	card=0
	cards=`sysctl dev.twe | grep location | wc -l`
	echo
	echo "Hardware RAID status:"
	while [ $cards -gt $card ]
	  do
	    unit=0
	    units=`sysctl dev.twed | grep "%parent: twe$card" | wc -l`
	    while [ $units -gt $unit ]
	      do
	        info=`sysctl -n dev.twed.$unit | grep "Unit $unit"`
	        raid=`echo $info | cut -d " " -f 3`
	        status=`echo $info | cut -d " " -f 4`
	        echo Controller `expr $card + 1`: `sysctl -n dev.twe.$card.%desc`
	        echo "      Unit `expr $unit + 1`: $raid Status=$status"
	        if [ "$status" != "Normal" ]; then  rc=3;  fi
	        unit=$(expr $unit + 1)
	      done
	    card=$(expr $card + 1)
	  done
	;;

    *)  rc=0;;
esac

exit $rc


>
> +>  # 405.status-ata_raid
> +>  daily_status_ata_raid_enable="NO"			# Check ATA raid status
> +> +
> +> +# 406.status-gmirror
> +> +daily_status_gmirror_enable="NO"			# Check gmirror(8)
>
> Why we turn off those two by default?
> It is really not expensive to get state of the mirrors.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20060116/2067a217/attachment.bin


More information about the cvs-src mailing list