aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/ipmitool
diff options
context:
space:
mode:
authorzi <zi@FreeBSD.org>2012-02-28 21:56:24 +0800
committerzi <zi@FreeBSD.org>2012-02-28 21:56:24 +0800
commit119329fac755946fc1c22044fa2a4c1e2461e603 (patch)
tree0acc81741554bf6ee14625f1675f2b3dd24b9db9 /sysutils/ipmitool
parent4dc46faca6f78c58913be628b1ab9a877f40bc16 (diff)
downloadfreebsd-ports-gnome-119329fac755946fc1c22044fa2a4c1e2461e603.tar.gz
freebsd-ports-gnome-119329fac755946fc1c22044fa2a4c1e2461e603.tar.zst
freebsd-ports-gnome-119329fac755946fc1c22044fa2a4c1e2461e603.zip
- 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)
Diffstat (limited to 'sysutils/ipmitool')
-rw-r--r--sysutils/ipmitool/Makefile15
-rw-r--r--sysutils/ipmitool/files/status-ipmi.sh.in61
2 files changed, 73 insertions, 3 deletions
diff --git a/sysutils/ipmitool/Makefile b/sysutils/ipmitool/Makefile
index edef1472ac20..3b928f634acc 100644
--- a/sysutils/ipmitool/Makefile
+++ b/sysutils/ipmitool/Makefile
@@ -7,7 +7,7 @@
PORTNAME= ipmitool
PORTVERSION= 1.8.11
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= sysutils
MASTER_SITES= SF
@@ -19,21 +19,30 @@ DOS2UNIX= ipmi_fwum.c
USE_GMAKE= yes
USE_OPENSSL= yes
GNU_CONFIGURE= yes
-CONFIGURE_ARGS+= --enable-intf-lan --enable-intf-lanplus \
+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}
+SUB_FILES= status-ipmi.sh
PORTDOCS= AUTHORS COPYING ChangeLog README
MAN1+= ${PORTNAME}.1
MAN8+= ipmievd.8
+PERIODIC_DIR= etc/periodic/daily
+
.if defined(WITH_DEBUG)
CFLAGS+= -ggdb -Wall
.endif
.include <bsd.port.pre.mk>
+post-install:
+ @${MKDIR} ${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/sysutils/ipmitool/files/status-ipmi.sh.in b/sysutils/ipmitool/files/status-ipmi.sh.in
new file mode 100644
index 000000000000..b4084b2b463e
--- /dev/null
+++ b/sysutils/ipmitool/files/status-ipmi.sh.in
@@ -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 \ No newline at end of file