Script using prstat

Hi,

I need a script which uses prstat command to check the performance . if a load averages crosses some threshold means I should receive the mail. this script should always run in back ground.

Kindly help me on this.

if [ "$( uptime | awk '{print $11}' | cut -d. -f1 )" -gt "10" ]; then echo "too high"; else echo "fine..."; fi

I found this piece of code long time ago in the forum - that's the beginning - add the mail part, use & to run it in the background. Adjust the number 10 to set your own definition of loaded server.
P.S. You don't need to use prstat, uptime is much easier.