I always need to check the processes that are consuming CPU at my machine, using ps its easy. With the following command, you can write a script and then send email, take action, etc.
ps aux –sort=-pcpu | head -n 10
You can play with TOP also, but I prefer PS for this case.
top -b -c -n 1 | head -n 17 | tail -n 10