LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-25-2011, 11:13 PM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 37
Script to find Disk utilized processes.


I have written a script that triggers a mail if the server load average goes beyond a specific value.

The mail contains following field
Current Load average.
Top 10 CPU utilized processes.
Code:
ps -auxf | sort -nr -k 3 | head -10
Top 10 Memory Utilized processes.
Code:
ps -auxf | sort -nr -k 4 | head -10
But the problem is that whenever there is any disk related activity happens the load gets high and the command (for ex.mkfs.ext3 /dev/sdb1, dd,scp,cp)which are the main cause behind the load average doesnt get displayed in top 10 CPU/Memory Utilized processes.

Is there any way of finding top 10 processes for Disk related activity?
 
Old 05-25-2011, 11:30 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Code:
iotop -b -n1 -o -P -qqq | head -n 10
The iotop command is like top, but lists processes doing I/O.
 
Old 05-26-2011, 12:07 AM   #3
pinga123
Member
 
Registered: Sep 2009
Posts: 684

Original Poster
Blog Entries: 2

Rep: Reputation: 37
Quote:
Originally Posted by macemoneta View Post
Code:
iotop -b -n1 -o -P -qqq | head -n 10
The iotop command is like top, but lists processes doing I/O.
iotop not installed in the distribution.
 
Old 05-26-2011, 12:23 AM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Most major distributions have it available for installation. You can also get it here.
 
Old 05-26-2011, 12:46 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,139

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
iotop Taskstats requires taskstats to be:
a) available in the kernel, and
b) enabled.

If the distro doesn't ship iostats, it's likely they don't (yet) have a kernel that supports it. Try a later release of the distro.

I have grave concerns about using loadavg as a trigger like this in Linux. It's quite common to see high loadavg with little or no CPU usage and little (or no) I/O.
But, it's Linux - the choice is yours.
 
Old 05-26-2011, 02:22 AM   #6
pinga123
Member
 
Registered: Sep 2009
Posts: 684

Original Poster
Blog Entries: 2

Rep: Reputation: 37
Quote:
Originally Posted by syg00 View Post
iotop Taskstats requires taskstats to be:
a) available in the kernel, and
b) enabled.

If the distro doesn't ship iostats, it's likely they don't (yet) have a kernel that supports it. Try a later release of the distro.

I have grave concerns about using loadavg as a trigger like this in Linux. It's quite common to see high loadavg with little or no CPU usage and little (or no) I/O.
But, it's Linux - the choice is yours.
I would like to hear what causes the High Loadavg if its not CPU or I/O?
 
Old 05-26-2011, 06:14 AM   #7
16pide
Member
 
Registered: Jan 2010
Posts: 418

Rep: Reputation: 83
iotop works great.
It was not installed by default, but I used yum to get it and I love it.

@pinga123: which distro do you use, and doesn't it have iotop in its repository?
 
Old 05-26-2011, 06:48 AM   #8
pinga123
Member
 
Registered: Sep 2009
Posts: 684

Original Poster
Blog Entries: 2

Rep: Reputation: 37
Quote:
Originally Posted by 16pide View Post
iotop works great.
It was not installed by default, but I used yum to get it and I love it.

@pinga123: which distro do you use, and doesn't it have iotop in its repository?
I checked the repository but no package starting from iotop* found.
Code:
# lsb_release -a
LSB Version:    :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: EnterpriseEnterpriseServer
Description:    Enterprise Linux Enterprise Linux Server release 5.2 (Carthage)
Release:        5.2
Codename:       Carthage
Tried downloading and installing iotop from external sources but the iotop seems to be made for Linux >= 2.6.20
Code:
# rpm -ivh python-ctypes-1.0.2-2.el5.i386.rpm
warning: python-ctypes-1.0.2-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing...                ########################################### [100%]
   1:python-ctypes          ########################################### [100%]
# rpm -ivh iotop-0.4.1-2.el5.noarch.rpm
warning: iotop-0.4.1-2.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing...                ########################################### [100%]
   1:iotop                  ########################################### [100%]
# iotop
Could not run iotop as some of the requirements are not met:
- Linux >= 2.6.20 with
  - I/O accounting support (CONFIG_TASKSTATS, CONFIG_TASK_DELAY_ACCT, CONFIG_TASK_IO_ACCOUNTING)
# uname -r
2.6.18-92.el5

Last edited by pinga123; 05-26-2011 at 06:57 AM.
 
Old 05-26-2011, 06:50 AM   #9
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
iotop is in the sysstat package.

Edit: correction. iostat is in the sysstat package. iotop is all by itself in the Ubuntu (my system's) repository.

Last edited by stress_junkie; 05-26-2011 at 06:53 AM.
 
Old 05-26-2011, 06:59 AM   #10
pinga123
Member
 
Registered: Sep 2009
Posts: 684

Original Poster
Blog Entries: 2

Rep: Reputation: 37
is iotop and iostat does the same? I dont have iostat too is there easier way to enable it?
edited:
Enabled iostat by installing sysstat package.
Does iostat tells which process is causing high io utilization. by simply giving iostat results in total read/write on every disk.

Last edited by pinga123; 05-26-2011 at 07:04 AM.
 
Old 05-27-2011, 03:08 AM   #11
16pide
Member
 
Registered: Jan 2010
Posts: 418

Rep: Reputation: 83
I am guessing you are using redhat 5.2 from your kernel name.
I did a bit of googling, andhere is what I found:
The EPEL repository could be what you need to get the iotop rpm:
http://www.cyberciti.biz/faq/rhel-fe...ble-epel-repo/

http://download.fedora.redhat.com/pu...r_i.group.html
 
1 members found this post helpful.
Old 05-30-2011, 10:38 PM   #12
pinga123
Member
 
Registered: Sep 2009
Posts: 684

Original Poster
Blog Entries: 2

Rep: Reputation: 37
Quote:
Originally Posted by 16pide View Post
I am guessing you are using redhat 5.2 from your kernel name.
I did a bit of googling, andhere is what I found:
The EPEL repository could be what you need to get the iotop rpm:
http://www.cyberciti.biz/faq/rhel-fe...ble-epel-repo/

http://download.fedora.redhat.com/pu...r_i.group.html
Installed iotop from the link you mentioned but now i m confused on how to fulfill its requirement Do i need to change the Kernel parameter as mentioned in below output? How?.
Code:
# iotop
Could not run iotop as some of the requirements are not met:
- Linux >= 2.6.20 with
  - I/O accounting support (CONFIG_TASKSTATS, CONFIG_TASK_DELAY_ACCT, CONFIG_TASK_IO_ACCOUNTING)
 
Old 06-06-2011, 07:52 AM   #13
16pide
Member
 
Registered: Jan 2010
Posts: 418

Rep: Reputation: 83
to check your kernel version, can you post output of:
Code:
uname -a
And can someone comment on the flags pinga123 mentions in his latest post?
 
Old 06-06-2011, 11:20 PM   #14
pinga123
Member
 
Registered: Sep 2009
Posts: 684

Original Poster
Blog Entries: 2

Rep: Reputation: 37
Quote:
Originally Posted by 16pide View Post
to check your kernel version, can you post output of:
Code:
uname -a
And can someone comment on the flags pinga123 mentions in his latest post?
Its 2.6.18.
 
Old 06-06-2011, 11:29 PM   #15
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,139

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
(just noticed this thread again).
As I stated above, you must be on a kernel that has taskstats support. At 2.6.18, no (userspace) tool can provide the data as it doesn't exist.

Upgrade is the only answer.
 
1 members found this post helpful.
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is 'nice' inherited to child processes? e.g. bash script/php script that calls MySQL SirTristan Linux - Newbie 1 12-04-2008 12:57 AM
req: way to find out which processes are hogging disk I/O Lunixer Linux - Newbie 2 12-23-2007 07:25 PM
"disk sleep" processes, can I find what they're waiting for? karlmdv Linux - General 0 09-20-2006 06:24 AM
memory not being utilized wendy Linux - Newbie 6 04-15-2003 03:05 PM
How much memory is utilized? Manish Linux - Newbie 2 02-23-2002 05:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:30 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