Script to monitor Values


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to monitor Values
# 1  
Old 07-26-2012
Script to monitor Values

Hi All,

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

Code:
[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...

Code:
#!/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
# 2  
Old 07-26-2012
Code:
 awk ' $NF > 680 { print $0 }'

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Script monitor website wth default tomcat script

Hi all, on our application server we have the following script that monitor the status of the website, my problem here is that i have edite the retries from 3 to 5, and the timewait to 120 second, so the script should check 5 times every 2 minutes, and if the fifth check fails it must restart... (0 Replies)
Discussion started by: charli1
0 Replies

2. Infrastructure Monitoring

Searching for Saas Monitor service which monitor my servers which are sitting in different providers

Sorry if this is the wrong forum Searching for Saas Monitor service which monitor my servers which are sitting in different providers . This monitor tool will take as less CPU as possible , and will send info about the server to main Dashboard. The info I need is CPU / RAM / my servers status (... (1 Reply)
Discussion started by: umen
1 Replies

3. Shell Programming and Scripting

Monitor the services by script

I developed for monitoring the network connections among the branch servers as I given below as script.But I don't know how to monitor the services through network script whether the services is running or not. eg : I want to check the postgres service for all the branch servers through network... (0 Replies)
Discussion started by: kannansoft1985
0 Replies

4. Shell Programming and Scripting

How to monitor a shell script called within a script?

HIi Guys... I am in a fix.... 1st the code : Script 123.sh looks like this : ./abc # a script which is getting called in this script while true do count=`ps -ef | grep abc | wc -l` if echo "abc is running sleep 10 fi done but the process is getting checked... (5 Replies)
Discussion started by: chatwithsaurav
5 Replies

5. Shell Programming and Scripting

Query the table and return values to shell script and search result values from another files.

Hi, I need a shell script, which would search the result values from another files. 1)execute " select column1 from table_name" query on the table. 2)Based on the result, need to be grep from .wft files. could please explain about this.Below is the way i am using. #!/bin/sh... (4 Replies)
Discussion started by: Rami Reddy
4 Replies

6. UNIX for Dummies Questions & Answers

Monitor a script

Hi All, In a script I would like to check whether the current running command is completed in 1 hour or not. This i want to achieve inside the same script. I don't want to use separate script to monitor my current running script. eg. pseudocode; Command1 if command1>60 mins then... (7 Replies)
Discussion started by: Vicky5
7 Replies

7. Shell Programming and Scripting

Monitor script

Does anyone have a monitoring script in solaris that monitors the drives in an exclosure? The script should be in /bin/bash or /bin/sh thnks again This should be for solaris 10/11 looking for something that tells me a drive is down or offline.:confused: (0 Replies)
Discussion started by: walnutpony123
0 Replies

8. Shell Programming and Scripting

Help with HD monitor script

Hi, I'm new to linux and I'm trying to compile a hard drive monitoring script. I've seen a few on the internet and I've attempted to stumble through but I'm stuck at my while/do scenario. I assigned the variable NUM then took the percentage from my output and cut the % so it would be just a... (6 Replies)
Discussion started by: crocyson
6 Replies

9. Shell Programming and Scripting

server monitor script...

hi all i have a script which will write a log file depending upon output of TOP command ( i am on HP-UX ) and some rules to analyze processes if process falls under that rule then log entry in file. i am ready with this part i have perl script which does this for me but i have 3 HP servers and... (1 Reply)
Discussion started by: zedex
1 Replies
Login or Register to Ask a Question