Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-09-21
3
Medium Priority
?
445 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 2000 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.
Suggested Courses

604 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