From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Feb 16 14:00:32 2012 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 628B9106566C for ; Thu, 16 Feb 2012 14:00:32 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 396568FC12 for ; Thu, 16 Feb 2012 14:00:32 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q1GE0WYb090351 for ; Thu, 16 Feb 2012 14:00:32 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q1GE0Wf1090350; Thu, 16 Feb 2012 14:00:32 GMT (envelope-from gnats) Resent-Date: Thu, 16 Feb 2012 14:00:32 GMT Resent-Message-Id: <201202161400.q1GE0Wf1090350@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Will Glozer Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D43B1065672 for ; Thu, 16 Feb 2012 13:51:51 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 2C6968FC08 for ; Thu, 16 Feb 2012 13:51:51 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q1GDpojA056719 for ; Thu, 16 Feb 2012 13:51:50 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q1GDpoMt056718; Thu, 16 Feb 2012 13:51:50 GMT (envelope-from nobody) Message-Id: <201202161351.q1GDpoMt056718@red.freebsd.org> Date: Thu, 16 Feb 2012 13:51:50 GMT From: Will Glozer To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/165204: sysutils/ipmitool should have periodic IPMI status check X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2012 14:00:32 -0000 >Number: 165204 >Category: ports >Synopsis: sysutils/ipmitool should have periodic IPMI status check >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Feb 16 14:00:30 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Will Glozer >Release: 9.0-RELEASE >Organization: >Environment: >Description: The sysutils/ipmitool port should include a periodic IPMI status check script for monitoring sensors and the system event log. >How-To-Repeat: >Fix: Attached is a patch that adds files/status-ipmi.sh, which is installed as ${PREFIX}/etc/periodic/daily/400.status-ipmi When /etc/periodic.conf contains 'daily_status_ipmi_enable="YES"' this script will run and output the current sensor readings, a warning if the SEL log capacity is >= 80%, and warning if any new SEL entries have been created since the last run. Patch attached with submission follows: diff --git a/Makefile b/Makefile index 3c390ba..e94217a 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ PORTNAME= ipmitool PORTVERSION= 1.8.11 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= sysutils MASTER_SITES= SF @@ -21,19 +21,31 @@ USE_OPENSSL= yes GNU_CONFIGURE= yes CONFIGURE_ARGS+= --enable-intf-lan --enable-intf-lanplus \ --disable-intf-imb --disable-intf-lipmi --disable-intf-bmc -PLIST_FILES= bin/ipmitool sbin/ipmievd share/ipmitool/oem_ibm_sel_map +PLIST_FILES= bin/ipmitool sbin/ipmievd share/ipmitool/oem_ibm_sel_map \ + ${PERIODIC_DIR}/400.status-ipmi PLIST_DIRS= share/ipmitool +PLIST_DIRSTRY= ${PERIODIC_DIR} PORTDOCS= AUTHORS COPYING ChangeLog README MAN1+= ${PORTNAME}.1 MAN8+= ipmievd.8 +PERIODIC_DIR= etc/periodic/daily +SED_SCRIPT= -e 's|%%PREFIX%%|${PREFIX}|g' + .if defined(WITH_DEBUG) CFLAGS+= -ggdb -Wall .endif .include +post-build: + @${SED} ${SED_SCRIPT} ${FILESDIR}/status-ipmi.sh > ${WRKDIR}/status-ipmi.sh + +post-install: + @${MKDIR} -p ${PREFIX}/${PERIODIC_DIR} + @${INSTALL_SCRIPT} ${WRKDIR}/status-ipmi.sh ${PREFIX}/${PERIODIC_DIR}/400.status-ipmi + .if exists(/usr/include/sys/ipmi.h) CONFIGURE_ARGS+= --enable-intf-open .else diff --git a/files/status-ipmi.sh b/files/status-ipmi.sh new file mode 100755 index 0000000..06b2239 --- /dev/null +++ b/files/status-ipmi.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# +# Check status of IPMI sensors and System Event Log +# + +# 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 + +sdr_list_args=${daily_status_ipmi_sdr_list_args:-} +sel_list_args=${daily_status_ipmi_sel_list_args:-} +sel_cap_warn_pct=${daily_status_ipmi_sel_cap_warn_pct:-80} + +ipmitool=%%PREFIX%%/bin/ipmitool + +rc=0 + +case "${daily_status_ipmi_enable}" in + [Yy][Ee][Ss]) + if [ ! -x $ipmitool ]; then + echo "\$daily_status_ipmi_enable is set but ${ipmitool}" \ + "isn't executable" + exit 2 + fi + + echo "" + echo "Checking IPMI sensors:" + + $ipmitool sdr list $sdr_list_args && rc=1 || rc=3 + + echo "" + echo "Checking IPMI System Event Log:" + + info=`$ipmitool sel info` || exit 3 + used=$(echo "${info}" | awk '/Percent Used/{print 0 + $4}') + entries=$(echo "${info}" | awk '/Entries/{print 0 + $3}') + + if [ $used -gt $sel_cap_warn_pct ]; then + echo " SEL is at ${used}% capacity" + rc=3 + fi + + last=`cat /var/db/ipmi-sel-count 2>/dev/null || echo 0` + + if [ $entries -gt $last ]; then + echo $entries > /var/db/ipmi-sel-count + echo "" + $ipmitool sel list $sel_list_args + rc=3 + fi + ;; + *) + rc=0 + ;; +esac + +exit $rc >Release-Note: >Audit-Trail: >Unformatted: