This port provides an utility for getting information from

LSI Logic's MegaRAID RAID controllers.

WWW: http://lists.freebsd.org/pipermail/freebsd-scsi/2006-February/002294.html

PR:		ports/98803
Submitted by:	bz
This commit is contained in:
Erwin Lansing 2006-06-11 12:40:54 +00:00
parent e8e4a3210b
commit 29aa85dfc4
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=165098
6 changed files with 178 additions and 0 deletions

View File

@ -18,6 +18,7 @@
SUBDIR += agef
SUBDIR += ah-tty
SUBDIR += am-utils
SUBDIR += amrstat
SUBDIR += anacron
SUBDIR += and
SUBDIR += anteater

62
sysutils/amrstat/Makefile Normal file
View File

@ -0,0 +1,62 @@
# Ports collection makefile for: amrstat
# Date created: 2006-04-11
# Whom: "Bjoern A. Zeeb" <bzeeb+freebsd+ports@zabbadoz.net>
#
# $FreeBSD$
#
PORTNAME= amrstat
PORTVERSION= 20060414
CATEGORIES= sysutils
MASTER_SITES= http://people.freebsd.org/~jkim/
DISTNAME= ${PORTNAME}-${PORTVERSION}
MAINTAINER= bzeeb+freebsd+ports@zabbadoz.net
COMMENT= Utility for LSI Logic's MegaRAID RAID controllers
OPTIONS= MEGARC "Also install LSI megarc binary port.." off
.include <bsd.port.pre.mk>
.if ${OSVERSION} < 600105
IGNORE= does not build on FreeBSD 6.0 or earlier
.endif
# We may want this for periodic script and to actually be able
# to fix something in case amrstat reports degraded RAID.
.if defined(WITH_MEGARC)
RUN_DEPENDS= ${LOCALBASE}/sbin/megarc:${PORTSDIR}/sysutils/megarc
.endif
USRSRC?= /usr/src
SYSDIR= ${USRSRC}/sys
AMRSRC= ${SYSDIR}/dev/amr
MAKE_ENV= SYSDIR=${SYSDIR}
ALL_TARGET= ${PORTNAME}
LOCALSRCDIR= ${.CURDIR}/files
PERIODICSCRIPT= 407.status-amr-raid
NO_WRKSUBDIR= yes
SUB_FILES+= ${PERIODICSCRIPT}
post-extract:
@if [ ! -d ${AMRSRC} ]; then \
${ECHO} "=================================================="; \
${ECHO} "You need amr(4) sources in"; \
${ECHO} " ${AMRSRC}"; \
${ECHO} "to build this port."; \
${ECHO} "If your sources are not in ${USRSRC} set USRSRC."; \
${ECHO} "=================================================="; \
exit 1; \
fi
${RM} -f ${WRKSRC}/amrstat
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/amrstat ${PREFIX}/sbin
${INSTALL_SCRIPT} -d ${PREFIX}/etc/periodic/daily
${INSTALL_SCRIPT} ${WRKDIR}/${PERIODICSCRIPT} ${PREFIX}/etc/periodic/daily
.include <bsd.port.post.mk>

View File

@ -0,0 +1,3 @@
MD5 (amrstat-20060414.tar.gz) = 851dc6d87ec2dc9c58c2c209df021a5e
SHA256 (amrstat-20060414.tar.gz) = 2d512aa700c1d965f70826a0acf41fbd2fe40f94bf110c5c4d2aad0887e27556
SIZE (amrstat-20060414.tar.gz) = 30477

View File

@ -0,0 +1,104 @@
#!/bin/sh
#
# Show status of LSI Logic's MegaRAID RAID controllers.
#
# $FreeBSD$
#
# 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
# Defaults.
: ${daily_status_amr_raid_enable:=NO}
: ${daily_status_amr_raid_megarc_enable:=NO}
amrstat=${amrstat:-%%PREFIX%%/sbin/amrstat}
megarc=${megarc:-%%PREFIX%%/sbin/megarc}
logdir=${logdir:-/var/log}
case "$daily_status_amr_raid_enable" in
[Yy][Ee][Ss])
echo
echo 'Checking status of amr(4) raid controllers:'
rc=0
# Checking each controller.
for ctrl in `ls -1 /dev/amr[0-9]* | sed -e 's,/dev/amr,,g'`
do
echo ""
echo "Controller ${ctrl}:"
ctrl_log=${logdir}/amr_raid_${ctrl}
if test ! -f ${ctrl_log}.today; then
touch ${ctrl_log}.today
fi
mv -f ${ctrl_log}.today ${ctrl_log}.yesterday
${amrstat} -c ${ctrl} -g > ${ctrl_log}.today
if test -x ${megarc}; then
case "$daily_status_amr_raid_megarc_enable" in
[Yy][Ee][Ss])
${megarc} -dispCfg -a0 | col -b | grep -v Scanning | \
sed -e '/^A/s/.*/ .../g' >> ${ctrl_log}.today
;;
*) ;;
esac
fi
lines=`wc -l ${ctrl_log}.today | awk '{ print $1 }'`
diff -u -${lines} ${ctrl_log}.yesterday ${ctrl_log}.today
raid_rc=$?
if test $raid_rc -eq 0; then
cat ${ctrl_log}.today
fi
[ $rc -eq 0 ] && [ $raid_rc -ne 0 ] && rc=3
# Checking alarms.
#if test -x ${megarc}; then
#case "$daily_status_amr_raid_megarc_enable" in
# [Yy][Ee][Ss])
# echo "Alarms:"
# alarms_log=${logdir}/amr_raid_alarms
# ----------------------------------------
# There seems to be following option but does not seem to
# show anything sor me so I cannot verify that it is what
# I expect:
# ${megarc} -getNVRAMLog -a${ctrl}
# For me IPMI has some logs though:
# DATE sel[1]:
# A Drive - Slot/Connector - Fault - Drive Array - Slot 2
# ----------------------------------------
# Keep following commented out until someone confirms that it
# does something useful for him.
# ----------------------------------------
# if test ! -f ${alarms_log}.today; then
# touch ${alarms_log}.today
# fi
# mv -f ${alarms_log}.today ${alarms_log}.yesterday
# raid_rc=0
# ${megarc} -getNVRAMLog -a${ctrl} > ${alarms_log}.today
# cmp -zs ${alarms_log}.yesterday ${alarms_log}.today
# raid_rc=$?
# if test $raid_rc -ne 0; then
# diff -u ${alarms_log}.yesterday ${alarms_log}.today
# else
# echo " No new alarms."
# fi
# [ $rc -eq 0 ] && [ $raid_rc -ne 0 ] && rc=3
# ;;
#*) ;;
#esac
#fi
done
;;
*) rc=0;;
esac
exit $rc
# end

View File

@ -0,0 +1,4 @@
This port provides an utility for getting information from
LSI Logic's MegaRAID RAID controllers.
WWW: http://lists.freebsd.org/pipermail/freebsd-scsi/2006-February/002294.html

View File

@ -0,0 +1,4 @@
sbin/amrstat
etc/periodic/daily/407.status-amr-raid
@dirrmtry etc/periodic/daily
@dirrmtry etc/periodic