Load Check

floyd

Verified User
Joined
Mar 29, 2005
Messages
6,334
I am thinking a load check might be nice. Could be set up in the Admin Settings under the partition check. Could be set to check every 5, 10, or 15 minutes and have a customizable trigger load value in which to send an email.
 
Heres what we use, crude but:

every 5min cron
Code:
#!/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
If load is 4, email us... Just change the 4 if needed
 
Heres what we use, crude but:

every 5min cron
Code:
#!/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
If load is 4, email us... Just change the 4 if needed

can i have your script?
 
A good way to find cpu load is:

Code:
ps aux | awk '{sum +=$4}; END {print sum}'

You can replace $4 with whatever argument the cpu column is with your ps command.

Except I think that -ge requires a full integer value no decimals? So maybe you will have to strip that off.
 
Last edited:
Great!, but of course, this can be a core function of directadmin. It is very easy
 
Back
Top