ports/165204: sysutils/ipmitool should have periodic IPMI status check
Will Glozer
will at glozer.net
Thu Feb 16 14:00:32 UTC 2012
>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 <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:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list