summaryrefslogtreecommitdiff
path: root/scripts/checksel
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/checksel')
-rwxr-xr-xscripts/checksel30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/checksel b/scripts/checksel
new file mode 100755
index 0000000..63ea9a9
--- /dev/null
+++ b/scripts/checksel
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# checksel
+#
+# This script runs ipmiutil sel, writing any new records to syslog,
+# and will then clear the SEL if free space is low.
+#
+# The IPMI SEL should not normally be cleared, because the history
+# of the events is important, but if the IPMI SEL fills up, no new
+# events are logged, so saving the previous SEL events and clearing
+# the SEL must be done occasionally, as needed.
+#
+# app=`basename $0`
+# pdir=`echo $0 |sed -e "s/$app//"`
+pdir=/usr/bin
+ddir=/var/lib/ipmiutil
+# First check to see if the IPMI SEL is enabled on this system.
+# If not, do nothing else.
+$pdir/ipmiutil sel -v >/dev/null 2>&1
+if [ $? -eq 0 ]; then
+ # Write new SEL events to syslog, and check if free space is low
+ $pdir/ipmiutil sel -w |grep "WARNING: free space"
+ if [ $? -eq 0 ]; then
+ today=`date +%y%m%d`
+ # The old SEL records are in syslog, but save a copy in $ddir also.
+ $pdir/ipmiutil sel -e >$ddir/ipmisel_${today}.txt
+ # Clear the IPMI SEL
+ $pdir/ipmiutil sel -d
+ fi
+fi