LinuxQuestions.org
Help answer threads with 0 replies.
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 07-26-2007, 07:47 AM   #1
DotHQ
Member
 
Registered: Mar 2006
Location: Ohio, USA
Distribution: Red Hat, Fedora, Knoppix,
Posts: 548

Rep: Reputation: 33
Performance issue - finding top process


I have a web server that has started showing high load averages & high cpu usage.
Using SAR I can see the CPU and Load Average Stats easy enough. Lets say I see high CPU usage and a high Load average yesterday at 3:10pm.
Is there anything that can tell me what processes were running then, and most important how much CPU percentage each process was using at that time?

TIA!!!
 
Old 07-26-2007, 11:56 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
IIRC, no. Tools like SAR, Atsar and dstat provide a global stats. To get a close-up view you could run 'atop' in logging mode and later replay the data. Another way could be to run something (lame) like this
Code:
__genCpuhoglist() { 
/bin/ps -eo %C -eo pid,command|sort -bgr -k1|head -10|while \
read cpu pid command; do [ ${cpu%%.*} -gt 5 ] && logger "CPU:\
 ${command%% *}: ${cpu}%"; done; sleep 10s; # EDIT: if you use the right syntax :-]
__genCpuhoglist; }
which logs any hogs above 5 and sleeps for 10 seconds.

Last edited by unSpawn; 07-27-2007 at 11:20 AM.
 
Old 07-26-2007, 07:49 PM   #3
DotHQ
Member
 
Registered: Mar 2006
Location: Ohio, USA
Distribution: Red Hat, Fedora, Knoppix,
Posts: 548

Original Poster
Rep: Reputation: 33
Thanks unSpawn! Not lame at all. I will try both of your ideas.
 
  


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
Can a user rename a process so it comes up with a custom name in 'top?' Lumberg Linux - General 7 01-11-2006 02:33 AM
top process full path toolshed Linux - Software 7 02-01-2005 04:45 PM
Finding process path praj_linux Solaris / OpenSolaris 5 12-21-2004 10:01 AM
Can't see process with ps or top Lemon Songster Linux - Newbie 0 10-23-2004 08:52 AM
top utility and performance bektas Programming 2 08-05-2003 03:33 PM

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

All times are GMT -5. The time now is 04:38 PM.

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