Load Monitor script

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,113
Location
California
I've cleaned up and re-issued my load-monitor script; you can find it here (www.nobaloney.net). It's released at no charge under the GNU General Public License, Version 2.

It's designed to give you email warning of a high server load and to optionally reload httpd.

Jeff
 
Thanks Jeff for providing it.

If I get it to work in a cron and it will help me with my problem, you'll need to provide donation information :D
 
You're very welcome. Note on line 61 this script uses a typical Linux restart command for httpd; your OS may require a different command.

Jeff
 
Very jlasman ,
it is Great script , very usefull

i have added two more functionalities on top of it

a. Monitor DoveCot is up
b. check free memory.

i am attaching the code from my script,
i will be happy if you find it handy and put it in your orginal script.

Best wishes


DOVEUP=`echo QUIT | nc localhost 110 | grep "OK Dovecot DA ready" | wc | awk '{ print $1 }'`
#echo $DOVEUP

if [ "$DOVEUP" == "1" ]; then
echo Dove UP
else
echo Dove Down
echo `date` " Dovecot is down" >>/var/log/scr/alarm/report
# killall -9 -u dovecot
# /etc/init.d/dovecot restart

fi

This is the Code for checking the free mem

# Memory check procedure
FREEMEM=`free -m -o | grep "Mem:" | awk '{ print $4 }'`
echo freemem $FREEMEM
if [ "$FREEMEM" -lt "256" ]; then
echo Memory bad
TIME=`date`
echo $TIME "Free memory" $FREEMEM >> /var/log/scr/alarm/report

sync; echo 3 > /proc/sys/vm/drop_caches


else
echo Memory ok
fi
 
Jeff,

I get the following:


TOP[1]=11:29AM: not found
TOP[2]=: not found
TOP[3]=70314: not found
TOP[4]=Swap:: not found
TOP[5]=Mem:: not found
httpd.load.sh: 1: Syntax error: Bad substitution
 
@judab2:

The linux/unix tradition has always been to have lots of small scripts that do their job well. I'd rather see additional scripts as required, and I'll work on more over time. If you'd like to write one in the meantime but have no place to host it I can host it for you.

@bdj:

The script was written on, and runs on CentOS. If it doesn't run for you, and you're not running CentOS or Red Hat Linux then hopefully someone else can help you. If you are running one of those, then make sure you've downloaded the script, not copied/pasted it from your browser, and that all the lines are correct.

Make sure your file as downloaded, and before any changes, has the correct md5sum:
Code:
d0a408e63c676bae6dc62f81f31819aa

Jeff
 
Jeff, thanks for the checksum, i've downloaded the script like you said but I try the checksum anyway.

I will try to figure it out myself to make in freebsd compatible.
 
Hello Jeff,

I like this script thanks for providing it :)

I have just one question, putting it in crontab is the proper way of using it right?

This is what I have, I guess I'm ok by that right?
Code:
root@server:/usr/local/scripts# crontab -l
*/1 * * * * /usr/local/scripts/httpd.load.sh > /dev/null 2>&1

Thanks a lot :)
 
I don't redirect the output. I'm not sure what happens if you do.

*/1 means the same as *; I use */5 and run it every five minutes.

Jeff
 
Request for new link

I've cleaned up and re-issued my load-monitor script; you can find it here (www.nobaloney.net). It's released at no charge under the GNU General Public License, Version 2.

It's designed to give you email warning of a high server load and to optionally reload httpd.

Jeff


Hello,
I want this script but the link isn't working. Can you give me a new link ?
 
Request for new link

I've cleaned up and re-issued my load-monitor script; you can find it here (www.nobaloney.net). It's released at no charge under the GNU General Public License, Version 2.

It's designed to give you email warning of a high server load and to optionally reload httpd.

Jeff


Hello,
I want this script but the link isn't working. Can you send a new link ?
 
Back
Top