Script to monitor Values

Hi All,

I want a scrip to monitor values which is the out put of a certain command. Example is

[xmp@tswebpxmpadmin ~]$ for (( c=1; c<15; c++ )); do cmu -O HTA -d HTTP-PROXY.tswebpxmp5.$c | grep -i active; done
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.activeStreams : 2
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.maxActiveStreams: 28
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.activeStreams : 6
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.maxActiveStreams: 23
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.activeStreams : 621
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.maxActiveStreams: 700
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.activeStreams : 596
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.maxActiveStreams: 700
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.activeStreams : 638
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.maxActiveStreams: 700
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.activeStreams : 692
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.maxActiveStreams: 700
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.activeStreams : 662
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.maxActiveStreams: 700
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.activeStreams : 661
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.maxActiveStreams: 700
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.activeStreams : 666
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.maxActiveStreams: 700
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.activeStreams : 611
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.maxActiveStreams: 700
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.activeStreams : 699
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.maxActiveStreams: 700
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.activeStreams : 673
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.maxActiveStreams: 700
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.activeStreams : 616
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.maxActiveStreams: 700
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.activeStreams : 636
        HTA_STATS_htaStatsDef.ifw_stats.streamStat.maxActiveStreams: 700

Here i need to monitor values for "activeStreams". If this is above 680 then it should echo a message.

At the moment i have come up with this...

#!/bin/sh

thresholdVal=680

for (( c=3; c<6; c++ ))
do
  for (( i=1; i<15; i++ ))
  do
  echo "HTTP-PROXY.tswebpxmp$c.$i"
  incomingStreamStat=`cmu -O HTA -d HTTP-PROXY.tswebpxmp$c.$i | grep active | tail -c 4`
  outgoingStreamStat=`cmu -O HTA -d HTTP-PROXY.tswebpxmp$c.$i | grep active | tail -c 4`
  echo "$incomingStreamStat"
  echo "$outgoingStreamStat"
  incomingInitial=`echo $incomingStreamStat | head -c 2`
  outgoingInitial=`echo $outgoingStreamStat | head -c 2`
  if [ $incomingInitial != ":" ] && [ $incomingStreamStat -gt $thresholdVal ]
  then
   echo "ALERT:The Active INcoming stream is exceeding than the max configured for process HTTP-PROXY.tswebpxmp$c.$i"
  fi
   
  if [ $outgoingInitial != ":" ] && [ $outgoingStreamStat -gt $thresholdVal ]
  then
   echo "ALERT:The Active OUTgoing stream is exceeding than the max configured for process HTTP-PROXY.tswebpxmp$c.$i"
  fi

  done
done

Please get me a detailed script which would be easier to understand, bcoz i have to explain it to customer and thats the most F*** part of it..

-Siddhesh

 awk ' $NF > 680 { print $0 }'