The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Installing RedHat 8.0 onto Dell PowerEdge SC1425 - hdc: status error: status = 0x58 fishsponge Linux 5 07-14-2006 11:53 AM
check the status and send an email with status isingh786 Shell Programming and Scripting 3 12-29-2005 03:22 PM
Why am I not recieving email notification? Kelam_Magnus Post Here to Contact Site Administrators and Moderators 6 09-03-2002 07:01 PM
Couldn't open status file /var/samba/STATUS.LCK macdonto UNIX for Dummies Questions & Answers 2 08-08-2001 05:42 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-11-2008
Registered User
 

Join Date: Sep 2007
Posts: 27
CPU status notification

i need a script which sends a mail when cpu is heavily loaded, for example ,

following is the output of the mpstat command,

CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
160 38 0 156 72 1 235 70 234 122 0 88 17 7 0 76
161 35 0 145 226 172 78 62 263 108 0 262 15 7 0 77
162 35 0 180 110 65 31 74 247 95 0 227 15 6 0 79
163 34 0 119 55 2 248 76 219 88 0 195 15 5 0 80
192 39 0 150 37 196 261 76 105 245 0 102 18 5 0 77
193 34 0 187 64 65 211 79 200 83 0 181 15 5 0 80
194 35 0 132 51 1 200 88 193 81 0 186 15 5 0 80
195 34 0 134 182 1 180 88 185 79 0 161 14 4 0 81


if system idl percentage is less than 10 % , it should check which process is using more cpu using prstat command and send a mail indicating process which are consuming more resourses....
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-11-2008
Registered User
 

Join Date: Mar 2008
Location: /bin/sh
Posts: 348
Lightbulb What have you tried..?

What have you tried so far..? This pseudo code might help you..

Code:
idle=`mpstat | awk '{print $10}' | tail -1`
if [$idle -lt 10]; then
echo "Warning"
echo "Further processing here"
else
echo "you are good to go"
fi
Please note : This is untested....
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:21 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0