Alert sent if server load average remains high for a specified length of time
We have already a 'load checker' thanks to ConfigServer Security & Firewall
#!/bin/sh
#
# Load Monitor
#
checkload=`uptime | cut -d, -f4 | cut -d: -f2 | cut -d. -f1`
if [ $checkload -ge [b]4[/b]]
then
echo -e "To: <email>\nFrom: <email>\nSubject:High Load On Server xx\nHigh Load On Server xx: $checkload" > /tmp/temp.txt
sendmail -t < /tmp/temp.txt
fi
Heres what we use, crude but:
every 5min cron
If load is 4, email us... Just change the 4 if neededCode:#!/bin/sh # # Load Monitor # checkload=`uptime | cut -d, -f4 | cut -d: -f2 | cut -d. -f1` if [ $checkload -ge [b]4[/b]] then echo -e "To: <email>\nFrom: <email>\nSubject:High Load On Server xx\nHigh Load On Server xx: $checkload" > /tmp/temp.txt sendmail -t < /tmp/temp.txt fi
ps aux | awk '{sum +=$4}; END {print sum}'