Use direct shell commands instead of $VAR

This commit is contained in:
Jeremy Gardais 2020-06-05 15:49:21 +02:00
parent 6b20157c56
commit 2db4453a76
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 17 additions and 17 deletions

View File

@ -141,11 +141,11 @@ get_status()
### Check the jobs ### Check the jobs
### ###
get_header "Jobs" "$QSTAT -l hostname=$MACHINEDOTS" get_header "Jobs" "$QSTAT -l hostname=$MACHINEDOTS"
jobs=$(${QSTAT} -l hostname=${MACHINEDOTS} -s r) jobs=$(${QSTAT} -l hostname=${MACHINEDOTS} -s r -u \*)
if [ -z "$jobs" ]; then if [ -z "$jobs" ]; then
echo "No Running Jobs" echo "No Running Jobs"
else else
${QSTAT} -l hostname=${MACHINEDOTS} -s r ${QSTAT} -l hostname=${MACHINEDOTS} -s r -u \*
fi fi
get_footer get_footer
@ -153,47 +153,47 @@ get_status()
### Check the host ### Check the host
### ###
get_header "Host" "$METAHS -i" get_header "Host" "$METAHS -i"
${QHOST} -h ${MACHINEDOTS} | ${GREP} -v "global" ${QHOST} -h ${MACHINEDOTS} | grep -v "global"
get_footer get_footer
### ###
### Identify queue memberships ### Identify queue memberships
### ###
#get_header "Queue Membership" "$QHOST -q" #get_header "Queue Membership" "$QHOST -q"
#${QHOST} -h ${MACHINEDOTS} -q | ${TAIL} +5 #${QHOST} -h ${MACHINEDOTS} -q | tail +5
#get_footer #get_footer
### ###
### Check queue instance states ### Check queue instance states
### ###
queueTriggered=false; queueTriggered=false;
# Queueset=$(${QHOST} -h ${MACHINEDOTS} -q | ${TAIL} +5 | ${AWK} '{ print $1 }') # Queueset=$(${QHOST} -h ${MACHINEDOTS} -q | tail +5 | awk '{ print $1 }')
${QHOST} -h ${MACHINEDOTS} -q | ${TAIL} +5 > "${PLUGIN_RESULT}.QSTATE" ${QHOST} -h ${MACHINEDOTS} -q | tail +5 > "${PLUGIN_RESULT}.QSTATE"
Queueset=$(cat "${PLUGIN_RESULT}.QSTATE" | ${AWK} '{ print $1 }') Queueset=$(cat "${PLUGIN_RESULT}.QSTATE" | awk '{ print $1 }')
for Qset in $Queueset; do for Qset in $Queueset; do
# qstate=$(${QHOST} -q -h ${MACHINEDOTS} | ${TAIL} +5 | $GREP " $Qset" | $AWK '{print $4}') # qstate=$(${QHOST} -q -h ${MACHINEDOTS} | tail +5 | grep " $Qset" | awk '{print $4}')
qstate=$(cat "${PLUGIN_RESULT}.QSTATE" | $GREP " $Qset" | $AWK '{print $4}') qstate=$(cat "${PLUGIN_RESULT}.QSTATE" | grep " $Qset" | awk '{print $4}')
# Order determines more significant color status # Order determines more significant color status
if [ "$(echo "${qstate}" | $GREP -c d)" != "0" ]; then if [ "$(echo "${qstate}" | grep -c d)" != "0" ]; then
COLOR="clear" COLOR="clear"
queueMsg=$(echo "$queueMsg<BR>$CLEAR_PIC $Qset@$HOST is DISABLED") queueMsg=$(echo "$queueMsg<BR>$CLEAR_PIC $Qset@$HOST is DISABLED")
queueTriggered=true; queueTriggered=true;
elif [ "$(echo "${qstate}" | $GREP -c E)" != "0" ]; then elif [ "$(echo "${qstate}" | grep -c E)" != "0" ]; then
COLOR="red" COLOR="red"
queueMsg=$(echo "$queueMsg<BR>$RED_PIC $Qset@$HOST is in ERROR!") queueMsg=$(echo "$queueMsg<BR>$RED_PIC $Qset@$HOST is in ERROR!")
queueTriggered=true; queueTriggered=true;
elif [ "$(echo "${qstate}" | $GREP -c c)" != "0" ]; then elif [ "$(echo "${qstate}" | grep -c c)" != "0" ]; then
COLOR="yellow" COLOR="yellow"
queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST has an ambigious configuration!") queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST has an ambigious configuration!")
queueTriggered=true; queueTriggered=true;
elif [ "$(echo "${qstate}" | $GREP -c a)" != "0" ] || \ elif [ "$(echo "${qstate}" | grep -c a)" != "0" ] || \
[ "$(echo "${qstate}" | $GREP -c A)" != "0" ]; then [ "$(echo "${qstate}" | grep -c A)" != "0" ]; then
queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is in ALARM") queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is in ALARM")
elif [ "$(echo "${qstate}" | $GREP -c s)" != "0" ] || \ elif [ "$(echo "${qstate}" | grep -c s)" != "0" ] || \
[ "$(echo "${qstate}" | $GREP -c S)" != "0" ]; then [ "$(echo "${qstate}" | grep -c S)" != "0" ]; then
queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is SUSPENDED") queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is SUSPENDED")
elif [ "$(echo "${qstate}" | $GREP -c u)" != "0" ]; then elif [ "$(echo "${qstate}" | grep -c u)" != "0" ]; then
COLOR="yellow" COLOR="yellow"
queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is UNAVAILABLE!") queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $Qset@$HOST is UNAVAILABLE!")
queueTriggered=true; queueTriggered=true;