Hot-Swapping hard drives on Dell PowerEdge 2850 running FBSD 5.5-PRE

Scott Mitchell scott+lists.freebsd at fishballoon.org
Mon Jun 26 11:07:24 UTC 2006


On Mon, Jun 26, 2006 at 11:32:18AM +0100, Alex Zbyslaw wrote:
> Joao Barros wrote:
> 
> >
> >Contrary to what megarc says, it's -h not -? for help.
> >Hope this helps.
> >
> ? is special to the shell so you need to escape it with a \.
> 
> h does not produce the same output for me - it's just treated as an 
> unknown command.  It also doesn't work as a param to commands, but help 
> seems to.

Yeah, megarc does have possibly the worst interface I've seen in quite a
long time.  Allegedly the Linux monitoring tools for these adapters will
work with 6.1, although I haven't tried this myself yet.

I've attached a couple of scripts I use for monitoring amr(4) adapters.
One (amr-check-status) is run hourly from crontab to alert of any change
in drive or array status.  The other (700.amr-status) is a daily periodic
script.  They could be extended to grovel through the megarc output to
figure out what adapters you have rather than just hardcoding the unit
numbers, but that seemed like more pain that it was worth (and I don't
have any machines with more than one adapter!)  BTW, the '^M' in the
amr-check-status script is a real Control-M character, and there are
embedded tabs in a couple of the egrep patterns, in case those get lost
in transit.

Cheers,

	Scott

-- 
===========================================================================
Scott Mitchell           | PGP Key ID | "Eagles may soar, but weasels
Cambridge, England       | 0x54B171B9 |  don't get sucked into jet engines"
scott at fishballoon.org | 0xAA775B8B |      -- Anon
-------------- next part --------------
#!/bin/sh -f
#
# Check status of RAID volumes on amr(4) controllers using the LSI MegaRC
# utility.  If any logical drive has a status other than OPTIMAL, or any
# physical disks has a status other that ONLINE, display the full status
# for the adapter.  If more than one adapter exists, add additional unit
# numbers to $adapters.
#
# $Id$
#

adapters="0"

for adapter in $adapters; do
	status=`/usr/local/sbin/megarc -ldinfo -a${adapter} -Lall -nolog |\
		/usr/bin/sed '1,$s/
//' |\
		/usr/bin/sed '1,/Information Of Logical Drive/d'` ||\
		echo "Failed to get RAID status for AMR adapter ${adapter}"

	echo "${status}" |\
		/usr/bin/egrep '^	  Logical Drive : .*:  Status: .*$' |\
		/usr/bin/egrep -qv 'OPTIMAL$'
	drives=$?

	echo "${status}" |\
		/usr/bin/egrep '^	[0-9]+' |\
		/usr/bin/egrep -qv 'ONLINE$'
	disks=$?

	if [ ${drives} -ne 1 -o ${disks} -ne 1 ]; then
		echo ""
		echo "AMR RAID status (adapter ${adapter}):"
		echo "${status}"
	fi
done
-------------- next part --------------
#!/bin/sh -f
#
# Display status of RAID volumes on amr(4) controllers using the LSI MegaRC
# utility.  If more than one adapter exists, add additional unit numbers to
# $adapters.
#
# $Id$
#

# 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

adapters="0"

rc=0
case "${daily_amr_status_enable:-YES}" in
	[Nn][Oo])
		;;
	*)
		for adapter in $adapters; do
			echo ""
			echo "AMR RAID status (adapter ${adapter}):"
			/usr/local/sbin/megarc -ldinfo -a${adapter} -Lall -nolog |\
			sed '1,/Information Of Logical Drive/d' || rc=$?
		done
		;;
esac

exit "$rc"


More information about the freebsd-questions mailing list