CPU utilization in linux script alert


This below script will update you whenever the server load goes beyond 15 with the load and the top 10 process which uses maximum CPU.

SUBJECT="`hostname`server load is high"
uptime > /tmp/load
if [ `uptime | awk '{ print$10 }' | cut -d. -f1` -gt 15 ];
echo "============================================" >> /tmp/load
`ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10 >> /tmp/load `
mail -s "$SUBJECT" $TO < /tmp/load

Thanks for viewing helpinlinux.com


  1. Free Stuff says:

    Hi there, just became aware of your weblog thru Google, and found that it’s truly informative. I? going to be careful for brussels. I?l appreciate if you happen to proceed this in future. Numerous other folks will likely be benefited out of your writing. Cheers!

  2. Fashion Trends says:

    Hello very cool site!! Man .. Beautiful .. Amazing .. I’ll bookmark your website and take the feeds additionally?I am glad to find numerous helpful info right here in the publish, we’d like develop extra techniques in this regard, thank you for sharing. . . . . .

Leave a Reply

Protected by WP Anti Spam