diff options
author | erwin <erwin@FreeBSD.org> | 2006-06-11 20:40:54 +0800 |
---|---|---|
committer | erwin <erwin@FreeBSD.org> | 2006-06-11 20:40:54 +0800 |
commit | 26dea897d052b207c91a2cc23438c2bae72eb93e (patch) | |
tree | 2e2f43ec24e3b57b61aa4cacd687df9ebb699f99 /sysutils/amrstat | |
parent | d8dc6ebfad65e2df4f2deb74e90d43e309378670 (diff) | |
download | freebsd-ports-gnome-26dea897d052b207c91a2cc23438c2bae72eb93e.tar.gz freebsd-ports-gnome-26dea897d052b207c91a2cc23438c2bae72eb93e.tar.zst freebsd-ports-gnome-26dea897d052b207c91a2cc23438c2bae72eb93e.zip |
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
Diffstat (limited to 'sysutils/amrstat')
-rw-r--r-- | sysutils/amrstat/Makefile | 62 | ||||
-rw-r--r-- | sysutils/amrstat/distinfo | 3 | ||||
-rw-r--r-- | sysutils/amrstat/files/407.status-amr-raid.in | 104 | ||||
-rw-r--r-- | sysutils/amrstat/pkg-descr | 4 | ||||
-rw-r--r-- | sysutils/amrstat/pkg-plist | 4 |
5 files changed, 177 insertions, 0 deletions
diff --git a/sysutils/amrstat/Makefile b/sysutils/amrstat/Makefile new file mode 100644 index 000000000000..580360dea12c --- /dev/null +++ b/sysutils/amrstat/Makefile @@ -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> diff --git a/sysutils/amrstat/distinfo b/sysutils/amrstat/distinfo new file mode 100644 index 000000000000..38eda87cb5b0 --- /dev/null +++ b/sysutils/amrstat/distinfo @@ -0,0 +1,3 @@ +MD5 (amrstat-20060414.tar.gz) = 851dc6d87ec2dc9c58c2c209df021a5e +SHA256 (amrstat-20060414.tar.gz) = 2d512aa700c1d965f70826a0acf41fbd2fe40f94bf110c5c4d2aad0887e27556 +SIZE (amrstat-20060414.tar.gz) = 30477 diff --git a/sysutils/amrstat/files/407.status-amr-raid.in b/sysutils/amrstat/files/407.status-amr-raid.in new file mode 100644 index 000000000000..2ffb10f92f9d --- /dev/null +++ b/sysutils/amrstat/files/407.status-amr-raid.in @@ -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 diff --git a/sysutils/amrstat/pkg-descr b/sysutils/amrstat/pkg-descr new file mode 100644 index 000000000000..59cfcb2d2171 --- /dev/null +++ b/sysutils/amrstat/pkg-descr @@ -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 diff --git a/sysutils/amrstat/pkg-plist b/sysutils/amrstat/pkg-plist new file mode 100644 index 000000000000..3bedef11535a --- /dev/null +++ b/sysutils/amrstat/pkg-plist @@ -0,0 +1,4 @@ +sbin/amrstat +etc/periodic/daily/407.status-amr-raid +@dirrmtry etc/periodic/daily +@dirrmtry etc/periodic |