Looking for shell script to monitor CPU utilization and send mail once exceed 75%


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Looking for shell script to monitor CPU utilization and send mail once exceed 75%
# 1  
Old 04-11-2012
Looking for shell script to monitor CPU utilization and send mail once exceed 75%

Dear Group,

I'm look for shell script to Monitor CPU usage and send mail once it exceed 75% I'm running Suse10.4.
# 2  
Old 04-11-2012
sorry bad post

Last edited by 47shailesh; 04-11-2012 at 12:53 PM.. Reason: posted script for memory usage.. sorry
# 3  
Old 04-11-2012
How is checking the memory usage going to help you detect high CPU load?
# 4  
Old 04-11-2012
use this for CPU usage:
Code:
if ! ps -e -o pcpu | awk '{c+=$1} END {if(c>75) exit 1;}'; then
  mailx -s "subject" -c "cc@user" "to@user" < emailbody
fi

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Monitor a file and send mail

I want to monitor the maillog file in real time and send a mail when a certain grep condition is met. Every time the grep condition is met a mail will be sent. I wish to ignore all grep conditions 30 mins after each mail and thereafter continue monitoring. For example: Condition is met, mail... (1 Reply)
Discussion started by: proactiveaditya
1 Replies

2. Shell Programming and Scripting

Script to monitor diskspace of /home/ not to exceed 80%

I want to monitor the diskspace of the /home/ directory NOT to exceed 80%. I want a script_file.sh for this. I am trying "df -h" command and I am stuck unable to extract the percentage. 1. HOW TO extract the percentage (I believe 5th column)? 2. IF we were able to extract the column,... (8 Replies)
Discussion started by: Shreyas N
8 Replies

3. Shell Programming and Scripting

Monitor file if match then send mail

Hi I want to monitor a file even if the file rotate. When a text occurs I want to send a mail. Something like this but it's not working correctly: tail -F mylog.log | grep 'MatchMe' | while read line do echo $(date +"%Y-%m-%d %H:%M:%S") MatchMe occurs | mail -s "MatchMe"... (1 Reply)
Discussion started by: chitech
1 Replies

4. Shell Programming and Scripting

Shell script to monitor process with high CPU

Hi, Linux redhat 5.5 I need to write a kshell script that shows all the process that consume 100% CPU (or more. strange but there are time that top shows higger value that 100) and they are active more than 5 minute. The top command shows all the relevat information: The PID of the cpu ,... (0 Replies)
Discussion started by: yoavbe
0 Replies

5. UNIX for Advanced & Expert Users

Shell script to monitor cpu and VMstat, iostat

Hi , I am new to scripting. please help me out how to write a script to monitor cpu , vmstat, iostat in Redhat linux. we are doing the load test. Thanks in advance !!!! (1 Reply)
Discussion started by: saanvi
1 Replies

6. Shell Programming and Scripting

Need help on shell script to monitor each user cpu use on a cluster over time

Hi, I am relatively new to the cluster administration and shell scripting. I need help on a shell script which can help me determine how many cpu's over time, any particular ( or all registered users on a cluster ) are using. To generate data say over a period of week and list of users and their... (6 Replies)
Discussion started by: anuj06
6 Replies

7. Shell Programming and Scripting

Basic script for monitor send mail service

Hi All Need help Can any one share a basic script that is used for monitor sendmail service whether online, offline.etc in solaris Thanks in advance Zimmy (5 Replies)
Discussion started by: zimmyyash
5 Replies

8. UNIX for Dummies Questions & Answers

How to monitor per core CPU utilization?

I can use top to see the overall cpu utilization in the system but i m using a system with 24 cores .How would i monitor each core utilization ? The system is used as Oracle VM Server for Virtualization. My distribution details. # lsb_release -a LSB Version: ... (8 Replies)
Discussion started by: pinga123
8 Replies

9. Homework & Coursework Questions

monitor log entries and send e-mail

I am stuck and worried. My assignment was due a day ago and I was too busy completing other assignments due during the same time. I worry that not completing this assignment will fail me. Need urgent help in completing the script asap. I dont want to sound pushy to get the answer but just wanted to... (10 Replies)
Discussion started by: vin8465
10 Replies

10. Emergency UNIX and Linux Support

monitor log entries and send e-mail

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! I am stuck and worried. My assignment was due a day ago and I was too busy completing other assignments due during the same time. I worry that not completing this assignment... (1 Reply)
Discussion started by: vin8465
1 Replies
Login or Register to Ask a Question