shell script to check cpu load on many servers

Pardon my noobness, what are the tools to prevent runaway processes eating 100% cpu and how to do that without running something constantly in the target server's memory?

Here is the shell script that if put into cron will preodically check servers via ssh

#to crontab for checks every 15 mins
#0,15 * * * * /path/to/this/script
#must be run once to suppress ssh hello screen
#touch ~/.hushlogin
#put here your server's ips
declare -a ips=("" "" "" "" "")

for i in "${ips[ @]}"
result=$(ssh -T $i "cat /proc/loadavg" 2>&1)
#the result can be parsed and some alerts issued or action taken
dt=`date +'%Y-%m-%d %H:%M'`
#append it into log file
echo "$dt $result" >> /user/name/cpumon/$i

Top News