From 2db4453a7633e214a12b7b4bd8a805236867d86a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Fri, 5 Jun 2020 15:49:21 +0200 Subject: [PATCH] Use direct shell commands instead of $VAR --- xymon/plugins/client/ext/sge.sh | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/xymon/plugins/client/ext/sge.sh b/xymon/plugins/client/ext/sge.sh index e6debe5..642e0cb 100755 --- a/xymon/plugins/client/ext/sge.sh +++ b/xymon/plugins/client/ext/sge.sh @@ -141,11 +141,11 @@ get_status() ### Check the jobs ### 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 echo "No Running Jobs" else - ${QSTAT} -l hostname=${MACHINEDOTS} -s r + ${QSTAT} -l hostname=${MACHINEDOTS} -s r -u \* fi get_footer @@ -153,47 +153,47 @@ get_status() ### Check the host ### get_header "Host" "$METAHS -i" - ${QHOST} -h ${MACHINEDOTS} | ${GREP} -v "global" + ${QHOST} -h ${MACHINEDOTS} | grep -v "global" get_footer ### ### Identify queue memberships ### #get_header "Queue Membership" "$QHOST -q" - #${QHOST} -h ${MACHINEDOTS} -q | ${TAIL} +5 + #${QHOST} -h ${MACHINEDOTS} -q | tail +5 #get_footer ### ### Check queue instance states ### queueTriggered=false; - # Queueset=$(${QHOST} -h ${MACHINEDOTS} -q | ${TAIL} +5 | ${AWK} '{ print $1 }') - ${QHOST} -h ${MACHINEDOTS} -q | ${TAIL} +5 > "${PLUGIN_RESULT}.QSTATE" - Queueset=$(cat "${PLUGIN_RESULT}.QSTATE" | ${AWK} '{ print $1 }') + # Queueset=$(${QHOST} -h ${MACHINEDOTS} -q | tail +5 | 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 "${PLUGIN_RESULT}.QSTATE" | $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}') # Order determines more significant color status - if [ "$(echo "${qstate}" | $GREP -c d)" != "0" ]; then + if [ "$(echo "${qstate}" | grep -c d)" != "0" ]; then COLOR="clear" queueMsg=$(echo "$queueMsg
$CLEAR_PIC $Qset@$HOST is DISABLED") queueTriggered=true; - elif [ "$(echo "${qstate}" | $GREP -c E)" != "0" ]; then + elif [ "$(echo "${qstate}" | grep -c E)" != "0" ]; then COLOR="red" queueMsg=$(echo "$queueMsg
$RED_PIC $Qset@$HOST is in ERROR!") queueTriggered=true; - elif [ "$(echo "${qstate}" | $GREP -c c)" != "0" ]; then + elif [ "$(echo "${qstate}" | grep -c c)" != "0" ]; then COLOR="yellow" queueMsg=$(echo "$queueMsg
$YELLOW_PIC $Qset@$HOST has an ambigious configuration!") queueTriggered=true; - elif [ "$(echo "${qstate}" | $GREP -c a)" != "0" ] || \ - [ "$(echo "${qstate}" | $GREP -c A)" != "0" ]; then + elif [ "$(echo "${qstate}" | grep -c a)" != "0" ] || \ + [ "$(echo "${qstate}" | grep -c A)" != "0" ]; then queueMsg=$(echo "$queueMsg
$YELLOW_PIC $Qset@$HOST is in ALARM") - elif [ "$(echo "${qstate}" | $GREP -c s)" != "0" ] || \ - [ "$(echo "${qstate}" | $GREP -c S)" != "0" ]; then + elif [ "$(echo "${qstate}" | grep -c s)" != "0" ] || \ + [ "$(echo "${qstate}" | grep -c S)" != "0" ]; then queueMsg=$(echo "$queueMsg
$YELLOW_PIC $Qset@$HOST is SUSPENDED") - elif [ "$(echo "${qstate}" | $GREP -c u)" != "0" ]; then + elif [ "$(echo "${qstate}" | grep -c u)" != "0" ]; then COLOR="yellow" queueMsg=$(echo "$queueMsg
$YELLOW_PIC $Qset@$HOST is UNAVAILABLE!") queueTriggered=true;