Solved

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

Posted on 2011-09-21
3
435 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

691 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