Solved

This is in RHEL 5.0 and AIX 5.3..Need a script

Posted on 2011-09-21
3
414 Views
Last Modified: 2012-05-12
This is in RHEL 5.0 and AIX 5.3..Need a script

I have a file in the location /home/ktabcd12/system.out.log

the system out.log gets appended as and we navigate the application

I need a scipt to look at Systemout.log every 15 mins and grep for
 
grep "** trying to find files for: ** took **" SystemOut.log >a.txt

cat a.txt

[9/21/11 17:23:24:130 GMT] 00000077 SystemOut     O com.app.doc.project.look.app.appInterface: trying to find files for: 403726 took 4893ms

[9/21/11 17:31:24:130 GMT] 00000077 SystemOut     O com.app.doc.project.look.app.appInterface: trying to find files for: 403726 took 5293ms

and from the file I need to look at  *ms and if the ms exceeds more than 10000 i.e if trying to find files for: 403726 took 10000ms or more

 ..I need to send an email saying an alert that  it is taking more tham 10000ms
0
Comment
Question by:aixtutorial
  • 2
3 Comments
 

Author Comment

by:aixtutorial
ID: 36575565
please provide a shell script for this
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36575704

#!/bin/bash

SYSTEM_OUT_FILE=/home/ktabcd12/system.out.log

grep 'trying to find files for:' $SYSTEM_OUT_FILE | awk '{print $(NF-2),$NF}' | sed 's/ms//g' | while read  FILE  TIME
do
  if [ $TIME -gt 10000 ]; then
    echo "File $file took more than 10000ms" | mail -s "$FILE slow"  <your email addres>
  fi
done

Open in new window

0
 
LVL 38

Accepted Solution

by:
wesly_chen earned 500 total points
ID: 36575715
Woo, type, lien 8 change to
echo "File $FILE took more than 10000ms" | mail -s "$FILE slow"  <your email addres>
#!/bin/bash

SYSTEM_OUT_FILE=/home/ktabcd12/system.out.log

grep 'trying to find files for:' $SYSTEM_OUT_FILE | awk '{print $(NF-2),$NF}' | sed 's/ms//g' | while read  FILE  TIME
do
  if [ $TIME -gt 10000 ]; then
    echo "File $FILE took more than 10000ms" | mail -s "$FILE slow"  <your email addres>
  fi
done

Open in new window

0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question