Register
It is currently Wed Apr 23, 2014 4:18 am

script to exectue command when server load


All times are UTC - 6 hours


Post new topic Reply to topic  [ 5 posts ] 
Author Message
 PostPosted: Mon Jun 16, 2008 4:48 pm   

Joined: Tue Dec 11, 2007 10:21 pm
Posts: 20
hello do anyone have any ideea about a script when server gets load more than 1.0 to run a command like mail to administrator or such things , any sugestion will be good welcome .

Thanks.


Top
 Profile  
 PostPosted: Tue Jun 17, 2008 2:32 am   
Moderator
User avatar

Joined: Thu Oct 11, 2007 7:12 am
Posts: 224
Location: London - UK
i suggest using nagios monitoring...
www.nagios.org


Top
 Profile  
 PostPosted: Tue Jun 17, 2008 4:04 am   

Joined: Tue Dec 11, 2007 10:21 pm
Posts: 20
DarthWavy wrote:
i suggest using nagios monitoring...
www.nagios.org


is not good for what i need. i need a script when server is load to run a comand like reboot .


Top
 Profile  
 PostPosted: Tue Jun 17, 2008 12:37 pm   
User avatar

Joined: Sun Apr 13, 2008 4:05 am
Posts: 37
Location: /dev/random
uptime |awk -F'average:' '{ print $2}'|cut -d"," -f2
will give you 5 minute load avarege, you can simply use it with a while and check it with a "sleep 300" .
but there is a problem that u cant use it, cos it depends on cpu count. dual core, core quad and other new amd cpus behaves like multi proccessor, so load avarage changes on every machine.


Top
 Profile  
 PostPosted: Fri Jun 27, 2008 10:34 am   

Joined: Tue Dec 05, 2006 8:37 pm
Posts: 30
Location: Thiruvananthapuram / India
I usually use the following script to get an alert email when load goes over a threshold value:

http://lijeesh.in/shell-scripts/bash/load-check.html (integer version)
http://lijeesh.in/shell-scripts/bash/load-check-rn.html ( real number version)

You need to put the script as a cron job so that it will run periodically (say every 10 minutes).


Top
 Profile WWW YIM  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP