Friday, 10 August 2012

Script which will send you email alert when load average is more than 5

Script which will send you email alert when load average is more than 5
===========

The script which will send you email alert wehn load average is more than 5:

#!/bin/bash
avg=`uptime | awk '{print $8" " $9 " "$10 $11 $12 }' | tr -s , " "`
cur=`uptime | awk '{print $10}' | tr -d , | cut -d. -f1`
str="============================="
info="Curent $avg"

if [ $cur -ge 5 ]; then
info1="Server load is high presently"
echo -e "$str\n$info\n$info1\n$str" | mail -s "Alert: Load Average for
`hostname` on `date`" abc@yourdom.com
else
# echo -e "$str\n$info\n$str"
fi

No comments:

Post a comment

Note: only a member of this blog may post a comment.