LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-27-2009, 06:05 PM   #1
nazs
Member
 
Registered: Apr 2005
Posts: 57

Rep: Reputation: 15
Tools or script to monitor load average on server


Hi All,
We have a server that is running RHEL4 that occasionally spikes in load average above 10 and we have no idea what is causing it. We would like to know if there are any free tools or a script that when the load average hits a certain point it will trigger the system to start logging the processes to see what is happening. Usually by the time we get logged into the system the load average is on its way down. If someone has a better idea please let me know.

Thanks you,
Nazs
 
Old 10-27-2009, 08:05 PM   #2
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Arrow

Quote:
Originally Posted by nazs View Post
Hi All,
We have a server that is running RHEL4 that occasionally spikes in load average above 10 and we have no idea what is causing it. We would like to know if there are any free tools or a script that when the load average hits a certain point it will trigger the system to start logging the processes to see what is happening. Usually by the time we get logged into the system the load average is on its way down. If someone has a better idea please let me know.

Thanks you,
Nazs
Whenever, load average is more, try to troubleshoot its cause by.

top
vmstat
iostat

....

and see if you can find anything useful. Have you tried these commands btw ?
 
Old 10-27-2009, 08:37 PM   #3
nazs
Member
 
Registered: Apr 2005
Posts: 57

Original Poster
Rep: Reputation: 15
Thanks for your response. I have tried TOP. But load average was already coming down and I did not see a process that would be causing any trouble. I will give the other command a try. Would still like to know if there was a way to log when it gets above a certain number.
 
Old 10-27-2009, 09:02 PM   #4
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Thumbs up

Quote:
Originally Posted by nazs View Post
Thanks for your response. I have tried TOP. But load average was already coming down and I did not see a process that would be causing any trouble. I will give the other command a try. Would still like to know if there was a way to log when it gets above a certain number.
Hey,

Put this script in background and see if you get something useful.

Code:
#!/bin/bash
exec &>/dev/null
load=`uptime |  awk '{print $10}' | awk -F"." '{print $1}'`;
if [ $load -gt 5 ]     # You can change this 5 to some other digit depending upon the CPUs you have
then
top -bn1 >> /tmp/logs
vmstat 1 5 >> /tmp/logs
iostat 1 5 >> /tmp/logs
mpstat 1 5 >> /tmp/logs 
mv /tmp/logs /tmp/logs_`date +%d-%B-%y_%H:%M`
fi
Put this in a file, say vikas.sh
and run it background.
Code:
bash vikas.sh &
This will generate a file of /tmp/logs_then_time.

Hope this helps.
 
Old 10-27-2009, 09:02 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
You could try (in a script) top in batch mode, every eg 2 mins, and if it finds a high load, start other monitoring cmds.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
load average ? mario.almeida Linux - General 5 08-03-2009 08:39 AM
Server with high load average and no obvious reason. DotHQ Linux - Server 15 03-06-2009 03:53 AM
Script to cause load average to increase paranoid times Linux - Software 2 04-14-2006 05:41 PM
load average? ampex189 Linux - Newbie 2 03-06-2005 07:17 PM
Load average 1.0, 1.0, 1.0 ? belated Linux - Newbie 4 11-30-2003 03:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration