From nobody@FreeBSD.org  Thu Feb 16 13:51:51 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4D43B1065672
	for <freebsd-gnats-submit@FreeBSD.org>; 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 <freebsd-gnats-submit@FreeBSD.org>; 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 <freebsd-gnats-submit@FreeBSD.org>; 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 <will@glozer.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: sysutils/ipmitool should have periodic IPMI status check
X-Send-Pr-Version: www-3.1
X-GNATS-Notify: spolyack@collaborativefusion.com

>Number:         165204
>Category:       ports
>Synopsis:       sysutils/ipmitool should have periodic IPMI status check
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    zi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 16 14:00:30 UTC 2012
>Closed-Date:    Tue Feb 28 13:57:09 UTC 2012
>Last-Modified:  Tue Feb 28 14:00:23 UTC 2012
>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 <bsd.port.pre.mk>
 
+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:
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Thu Feb 16 14:00:50 UTC 2012 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=165204 

From: Edwin Groothuis <edwin@FreeBSD.org>
To: spolyack@collaborativefusion.com
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/165204: sysutils/ipmitool should have periodic IPMI status check
Date: Thu, 16 Feb 2012 14:00:47 UT

 Maintainer of sysutils/ipmitool,
 
 Please note that PR ports/165204 has just been submitted.
 
 If it contains a patch for an upgrade, an enhancement or a bug fix
 you agree on, reply to this email stating that you approve the patch
 and a committer will take care of it.
 
 The full text of the PR can be found at:
     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/165204
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org

From: Steve Polyack <spolyack@collaborativefusion.com>
To: bug-followup@FreeBSD.org
Cc: Edwin Groothuis <edwin@FreeBSD.org>
Subject: Re: ports/165204: sysutils/ipmitool should have periodic IPMI	status
 check
Date: Fri, 24 Feb 2012 09:57:49 -0500

 On 02/16/2012 09:00 AM, Edwin Groothuis wrote:
 > Maintainer of sysutils/ipmitool,
 >
 > Please note that PR ports/165204 has just been submitted.
 >
 > If it contains a patch for an upgrade, an enhancement or a bug fix
 > you agree on, reply to this email stating that you approve the patch
 > and a committer will take care of it.
 >
 > The full text of the PR can be found at:
 >      http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/165204
 >
 The patch looks good to me.  Please apply it to the current ports tree.
 
 -- 
 http://www.intermedix.com
 Steve Polyack, Director of Network Operations
 T: 412-422-3463 x4026
 spolyack@collaborativefusion.com
 
 The information contained in this message is confidential and may be privileged and/or protected under law. If you received this message in error, please notify us immediately by forwarding a copy to karen.collier@intermedix.com and then deleting the original message and any attachments.
 
State-Changed-From-To: feedback->open 
State-Changed-By: linimon 
State-Changed-When: Fri Feb 24 16:59:40 UTC 2012 
State-Changed-Why:  
Maintainer approved. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=165204 
Responsible-Changed-From-To: freebsd-ports-bugs->zi 
Responsible-Changed-By: zi 
Responsible-Changed-When: Tue Feb 28 03:05:43 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=165204 
State-Changed-From-To: open->closed 
State-Changed-By: zi 
State-Changed-When: Tue Feb 28 13:57:08 UTC 2012 
State-Changed-Why:  
Committed, with minor changes. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=165204 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/165204: commit references a PR
Date: Tue, 28 Feb 2012 13:56:37 +0000 (UTC)

 zi          2012-02-28 13:56:24 UTC
 
   FreeBSD ports repository
 
   Modified files:
     sysutils/ipmitool    Makefile 
   Added files:
     sysutils/ipmitool/files status-ipmi.sh.in 
   Log:
   - Add periodic file for daily status information
   - Bump PORTREVISION
   
   PR:             ports/165204
   Submitted by:   Will Glozer <will@glozer.net>
   Approved by:    Steve Polyack <spolyack@collaborativefusion.com> (maintainer)
   
   Revision  Changes    Path
   1.25      +12 -3     ports/sysutils/ipmitool/Makefile
   1.1       +61 -0     ports/sysutils/ipmitool/files/status-ipmi.sh.in (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
