xcat-core/xCAT/postscripts/HPCbootstatus.linux
2010-11-25 07:16:56 +00:00

89 lines
2.6 KiB
Bash

#!/bin/sh
#
# Sample postscript to check appstatus for GPFS,LAPI and LoadL on Linux system.
# Report the appstatus to xcatd on MN.
# Set the default timeout to 5 mins.
TIMEOUT=300
INTERVAL=15
PASSED=0
# The number of items to check, currently including:
# gpfs-daemon, gpfs-quorum, gpfs-filesystem, lapi-pnsd, loadl-schedd, loadl-startd
ITEMNUM=6
gpfsd="hpcbootstatus gpfs-daemon=up"
gpfsq="hpcbootstatus gpfs-quorum=achieved"
# Use a loop
while [ true ]; do
COUNT=0
# Query gpfs-daemon,mmfsd
# Check 1191 port
port=`netstat -an|grep 1191`
if [ "$port" != "" ]; then
# Sent message to xcatd
updateflag.awk $MASTER 3002 "$gpfsd"
echo "HPCbootstatus.linux: Reporting $gpfsd to xcatd on $MASTER!"
let COUNT=$COUNT+1
fi
# Query gpfs-quorum
quorum=`/usr/lpp/mmfs/bin/mmgetstate -s|grep achieved`
if [ "$quorum" != "" ]; then
# Sent message to xcatd
updateflag.awk $MASTER 3002 "$gpfsq"
echo "HPCbootstatus.linux: Reporting $gpfsq to xcatd on $MASTER!"
let COUNT=$COUNT+1
fi
# Query gpfs-filesystem
fs=`/bin/mount |grep "type gpfs"|awk '{print $3}'|tr '\n' '!'`
if [ "$fs" != "" ]; then
# Sent message to xcatd
updateflag.awk $MASTER 3002 "hpcbootstatus gfsp-filesystem=$fs"
echo "HPCbootstatus.linux: Reporting gfsp-filesystem=$fs to xcatd on $MASTER!"
let COUNT=$COUNT+1
fi
# Query lapi-pnsd
lapi=`/usr/bin/lssrc -s pnsd |/usr/bin/awk '(NR==2){print $3}'`
if [ "$lapi" != "" ]; then
# Sent message to xcatd
updateflag.awk $MASTER 3002 "hpcbootstatus lapi-pnsd=$lapi"
echo "HPCbootstatus.linux: Reporting lapi-pnsd=$lapi to xcatd on $MASTER!"
let COUNT=$COUNT+1
fi
# Query loadl-schedd
hn=`hostname| tr '[A-Z]' '[a-z]'`
llsc=`/usr/bin/llrstatus -h $hn -r %sca %scs`
if [ "$llsc" != "" ]; then
# Sent message to xcatd
updateflag.awk $MASTER 3002 "hpcbootstatus loadl-schedd=$llsc"
echo "HPCbootstatus.linux: Reporting loadl-schedd=$llsc to xcatd on $MASTER!"
let COUNT=$COUNT+1
fi
# Query loadl-startd
llst=`/usr/bin/llrstatus -h $hn -r %sta %sts`
if [ "$llst" != "" ]; then
# Sent message to xcatd
updateflag.awk $MASTER 3002 "hpcbootstatus loadl-startd=$llst"
echo "HPCbootstatus.linux: Reporting loadl-startd=$llst to xcatd on $MASTER!"
let COUNT=$COUNT+1
fi
if [ $COUNT = $ITEMNUM ] || [ $PASSED -gt $TIMEOUT ]; then
exit
fi
let PASSED=$PASSED+$INTERVAL
sleep $INTERVAL
echo "HPCbootstatus.linux: passed $PASSED"
done