Fix old SGE and BB vars
This commit is contained in:
parent
fa02d6d485
commit
a4a6ba597f
|
@ -46,14 +46,15 @@
|
|||
##################################
|
||||
# CONFIGURE IT HERE
|
||||
##################################
|
||||
TEST="sge"
|
||||
BBPROG="$0"; export BBPROG
|
||||
readonly PLUGIN_NAME=$(basename "${0}")
|
||||
|
||||
SGEBIN=/usr/local/bin
|
||||
QSTAT=${SGEBIN}/qstat
|
||||
QHOST=${SGEBIN}/qhost
|
||||
QSELECT=${SGEBIN}/qselect
|
||||
export SGEBIN QSTAT QHOST QSELECT
|
||||
readonly TEST="sge"
|
||||
readonly PLUGIN_RESULT="${XYMONTMP}/${MACHINEDOTS}.${TEST}.plugin_result"
|
||||
|
||||
readonly QSTAT=$(command -v qstat)
|
||||
readonly QHOST=$(command -v qhost)
|
||||
readonly QSELECT=$(command -v qselect)
|
||||
export QSTAT QHOST QSELECT
|
||||
|
||||
# define colours for graphics
|
||||
# Comment these out if using older BB versions
|
||||
|
@ -66,25 +67,6 @@ UNKNOWN_PIC="&purple"
|
|||
##################################
|
||||
# Start of script
|
||||
##################################
|
||||
BBHOME="/var/BB/bb"; export BBHOME
|
||||
|
||||
if test ! "$BBHOME"
|
||||
then
|
||||
echo "template: BBHOME is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test ! -d "$BBHOME"
|
||||
then
|
||||
echo "template: BBHOME is invalid"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test ! "$BBTMP" # GET DEFINITIONS IF NEEDED
|
||||
then
|
||||
# echo "*** LOADING BBDEF ***"
|
||||
. $BBHOME/etc/bbdef.sh # INCLUDE STANDARD DEFINITIONS
|
||||
fi
|
||||
|
||||
get_header()
|
||||
{
|
||||
|
@ -137,22 +119,22 @@ get_status()
|
|||
COLOR="green"
|
||||
|
||||
# Check defaults have been set
|
||||
if [ "$SGEBIN" = "" ]; then
|
||||
SGEBIN=/usr/local/bin
|
||||
if [ "${QSTAT}" = "" ]; then
|
||||
readonly QSTAT=$(command -v qstat)
|
||||
echo ""
|
||||
echo "$YELLOW_PIC SGEBIN command is not defined in etc/bbsys.local - using default: $SGEBIN"
|
||||
echo "$YELLOW_PIC QSTAT command is not defined in etc/bbsys.local - using default: ${QSTAT}"
|
||||
fi
|
||||
|
||||
if [ "$QSTAT" = "" ]; then
|
||||
QSTAT=${SGEBIN}/qstat
|
||||
if [ "${QHOST}" = "" ]; then
|
||||
readonly QHOST=$(command -v qhost)
|
||||
echo ""
|
||||
echo "$YELLOW_PIC QSTAT command is not defined in etc/bbsys.local - using default: $QSTAT"
|
||||
echo "$YELLOW_PIC QHOST command is not defined in etc/bbsys.local - using default: ${QHOST}"
|
||||
fi
|
||||
|
||||
if [ "$QHOST" = "" ]; then
|
||||
QHOST=${SGEBIN}/qhost
|
||||
if [ "${QSELECT}" = "" ]; then
|
||||
readonly QSELECT=$(command -v qselect)
|
||||
echo ""
|
||||
echo "$YELLOW_PIC QHOST command is not defined in etc/bbsys.local - using default: $QHOST"
|
||||
echo "$YELLOW_PIC QSELECT command is not defined in etc/bbsys.local - using default: ${QSELECT}"
|
||||
fi
|
||||
|
||||
###
|
||||
|
@ -186,11 +168,11 @@ get_status()
|
|||
###
|
||||
queueTriggered=false;
|
||||
# Queueset=`${QHOST} -h ${MACHINEDOTS} -q | ${TAIL} +5 | ${AWK} '{ print $1 }'`
|
||||
${QHOST} -h ${MACHINEDOTS} -q | ${TAIL} +5 > $BBTMP/$MACHINE.$TEST.QSTATE
|
||||
Queueset=`cat $BBTMP/$MACHINE.$TEST.QSTATE | ${AWK} '{ print $1 }'`
|
||||
${QHOST} -h ${MACHINEDOTS} -q | ${TAIL} +5 > "${PLUGIN_RESULT}.QSTATE"
|
||||
Queueset=`cat "${PLUGIN_RESULT}.QSTATE" | ${AWK} '{ print $1 }'`
|
||||
for Qset in $Queueset; do
|
||||
# qstate=`${QHOST} -q -h ${MACHINEDOTS} | ${TAIL} +5 | $GREP " $Qset" | $AWK '{print $4}'`
|
||||
qstate=`cat $BBTMP/$MACHINE.$TEST.QSTATE | $GREP " $Qset" | $AWK '{print $4}'`
|
||||
qstate=`cat "${PLUGIN_RESULT}.QSTATE" | $GREP " $Qset" | $AWK '{print $4}'`
|
||||
|
||||
# Order determines more significant color status
|
||||
if [ "`echo $qstate | $GREP -c d`" != "0" ]; then
|
||||
|
@ -223,8 +205,8 @@ get_status()
|
|||
fi
|
||||
done
|
||||
|
||||
if [ -f $BBTMP/$MACHINE.$TEST.QSTATE ]; then
|
||||
$RM $BBTMP/$MACHINE.$TEST.QSTATE
|
||||
if [ -f "${PLUGIN_RESULT}.QSTATE" ]; then
|
||||
rm -f -- "${PLUGIN_RESULT}.QSTATE"
|
||||
fi
|
||||
|
||||
get_header "Queue Instance Status Report"
|
||||
|
@ -244,20 +226,20 @@ get_status()
|
|||
#####
|
||||
##### Main body
|
||||
#####
|
||||
get_status > $BBTMP/$MACHINE.$TEST
|
||||
get_status > "${PLUGIN_RESULT}"
|
||||
|
||||
# NOW USE THE BB COMMAND TO SEND THE DATA ACROSS
|
||||
$BB $BBDISP "status $MACHINE.$TEST $COLOR `$DATE` `$CAT $BBTMP/$MACHINE.$TEST`"
|
||||
# NOW USE THE XYMON COMMAND TO SEND THE DATA ACROSS
|
||||
$XYMON "${XYMONSRV}" "status ${MACHINE}.${TEST} ${COLOR} `$DATE` `cat ${PLUGIN_RESULT}`"
|
||||
#For testing only
|
||||
# echo $BB $BBDISP "status $BBTMP/$MACHINE.$TEST $COLOR `$DATE` `$CAT $BBTMP/$MACHINE.$TEST` ">/tmp/qtmp
|
||||
# echo $XYMON "${XYMONSRV}" "status ${MACHINE}.${TEST} ${COLOR} `$DATE` `cat ${PLUGIN_RESULT}`" > /tmp/sgetmp
|
||||
|
||||
|
||||
# Clean up our mess
|
||||
# Checking for existence of each file since the whole test may be optional
|
||||
# and may not actually run on every client
|
||||
#
|
||||
if [ -f $BBTMP/$MACHINE.$TEST ]; then
|
||||
$RM $BBTMP/$MACHINE.$TEST
|
||||
if [ -f "${PLUGIN_RESULT}" ]; then
|
||||
rm -f -- "${PLUGIN_RESULT}"
|
||||
fi
|
||||
##############################################
|
||||
# end of script
|
||||
|
|
Loading…
Reference in New Issue