CPU status notification


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting CPU status notification
# 1  
Old 06-11-2008
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....
# 2  
Old 06-11-2008
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....
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

How to track table status delete/update/insert status in DB2 V10 z/os?

Dear Team I am using DB2 v10 z/os database . Need expert guidance to figure out best way to track table activities ( Ex Delete, Insert,Update ) Scenario We have a table which is critical and many developer/testing team access on daily basis . We had instance where some deleted... (1 Reply)
Discussion started by: Perlbaby
1 Replies

2. UNIX for Dummies Questions & Answers

Is it possible to combine multiple CPU to act as a single CPU on the same server?

We have a single threaded application which is restricted by CPU usage even though there are multiple CPUs on the server, hence leading to significant performance issues. Is it possible to merge / combine multiple CPUs at OS level so it appear as a single CPU for the application? (6 Replies)
Discussion started by: Dissa
6 Replies

3. Linux

CPU on-line or off-line status

How to check CPU on-line or off-line status using single command in Linux? Thanks in advance. (1 Reply)
Discussion started by: forumguest
1 Replies

4. Solaris

Multi CPU Solaris system shows 100% CPU usage.

Hello Friends, On one of my Solaris 10 box, CPU usage shows 100% using "sar", "vmstat". However, it has 4 CPUs and prstat and glance are not showing enough processes to justify high CPU utilization. ========================================================================= $ prstat -a ... (4 Replies)
Discussion started by: mahive
4 Replies

5. Programming

Solaris CPU/memory status monitoring (Shell script or c++)

i'm trying to find a way to monitor the CPU/Memory status of a solaris station using vmstat. I like to write a small script to periodically run vmstat and store the output. Can anyone show me how (preferrably in C++ if possible)? Thanks in advance. (6 Replies)
Discussion started by: shingpui
6 Replies

6. UNIX for Dummies Questions & Answers

How to monitor Unix server CPU status?

I like to know how to monitor the UNIX CPU/memory status over time. I need to data to do some graphical representation of the server load. I sort of need to keep track of the vmstat but i dont know how. I hope someone would kindly help me out. thanks. (1 Reply)
Discussion started by: shingpui
1 Replies

7. UNIX for Dummies Questions & Answers

how to get persistant cpu utilization values per process per cpu in linux (! top,ps)

hi, i want to know cpu utilizatiion per process per cpu..for single processor also if multicore in linux ..to use these values in shell script to kill processes exceeding cpu utilization.ps (pcpu) command does not give exact values..top does not give persistant values..psstat,vmstat..does njot... (3 Replies)
Discussion started by: pankajd
3 Replies

8. UNIX for Advanced & Expert Users

command for CPU online/offline status in bash shell

Hi , How do i check that the CPU is online/offline in a multi CPU machine in Linux ? i tired /proc/cpuinfo dmesg nothing gave me the currect CPU status. Pls help !! (5 Replies)
Discussion started by: sars
5 Replies

9. Red Hat

Installing RedHat 8.0 onto Dell PowerEdge SC1425 - hdc: status error: status = 0x58

I have successfully installed RedHat 8.0 onto a Dell PowerEdge SC1425 today. This server has two SATA hard drives, and an IDE DVD-ROM drive. Using the following kernel parameters, i successfully installed across both hard drives from CD: ide0=0x1f0,0x3f6,14 vga=791 resolution=1024x768 expert... (5 Replies)
Discussion started by: fishsponge
5 Replies

10. UNIX for Dummies Questions & Answers

Couldn't open status file /var/samba/STATUS.LCK

I believe i have most of samba configured right but i get this error each time time try to run it. I was given suggestion that i touch the file, i did, but i still cannot rid myself of this error. Any suggestions (2 Replies)
Discussion started by: macdonto
2 Replies
Login or Register to Ask a Question