1833192 Members
2754 Online
110051 Solutions
New Discussion

Open files per process

 
SOLVED
Go to solution
Brian Lee_4
Regular Advisor

Open files per process

Is there any command or tool to find out that certain process opens how many files.

I had some issue with kernel parameter, nfile.
When open files reach the value of nfile, I can't telnet into the system.
I tried to find which process opened how many files but I couldn't.

Please help me out.
brian lee
15 REPLIES 15
harry d brown jr
Honored Contributor
Solution

Re: Open files per process

lsof

http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.70/

live free or die
harry
Live Free or Die
Pete Randall
Outstanding Contributor

Re: Open files per process

Sridhar Bhaskarla
Honored Contributor

Re: Open files per process

Hi,

You will have to install 'lsof' to find out the open files on the system. Simply use

lsof > lsof.out

Then sort out through second column. It is the pid of the process. You can write a small script to find the number of open files per process.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Fred Ruffet
Honored Contributor

Re: Open files per process

lsof is a great tool, and may easily be included in scripts, but if your action is done only once, and have glance already installed, it can give you the info.

regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Tim D Fulford
Honored Contributor

Re: Open files per process

dont you just hate it when 4 people get there before you... lsof... But I guess yopu got the idea!!

Tim
-
Camel_1
Valued Contributor

Re: Open files per process

GLANCE always is an option to check the process details.

Simon
Sanjay_6
Honored Contributor

Re: Open files per process

Hi,

Your problem may not be due to the no of processes, but could be due to the limit being reached on the number of telenet sessions allowed on the box.

Try this to identify yout problem and see if it can be due to something other than the limit on the no of files / processes.

http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000072193612

The ITRC doc id is KBRC00014017.

Hope this helps.

Regds

Bill Hassell
Honored Contributor

Re: Open files per process

Very important: nfile may be the originaql default value, jut a few hundred. It can be set to thousands or tens of thousands. Just run SAM and change the value. Remember that every process uses a minimum of 3 files (stdin, stdout, stderr) plus whatever the program needs. If you have 200 processes running, you can figure that nfile needs to be at least 1000. But to be sure, look at sar -v 1. The file and proc columns will show you the current values and maximum values. Your system is capable of running 10 or 100 times more processes--just adjust the kernel parameters.


Bill Hassell, sysadmin
Brian Lee_4
Regular Advisor

Re: Open files per process

I tried to install C compiler before I installed lsof but it requires "gmake".
Please let me know where I can get the program.
brian lee
Steven E. Protter
Exalted Contributor

Re: Open files per process

Just a note: If you run into a situation where nproc is set high but a given user or job can't seem to open enough processes.

check kernel parameter maxuprc

max processes per user.

It defaults to 75 and that can be a problem once in a while.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Manish Srivastava
Trusted Contributor

Re: Open files per process

harry d brown jr
Honored Contributor

Re: Open files per process

Brian, Don't build it, just download the RUN TIME depot and install it:

http://hpux.cs.utah.edu/ftp/hpux/Sysadmin/lsof-4.70/lsof-4.70-sd-11.00.depot.gz

put it on your server, then gunzip it:

cd /opt/
gunzip lsof-4.70/lsof-4.70-sd-11.00.depot.gz
swinstall -s /opt/lsof-4.70/lsof-4.70-sd-11.00.depot

live free or die
harry
Live Free or Die
Brian Lee_4
Regular Advisor

Re: Open files per process

After I install lsof depot, I run "lsof > lsof.file" command but I get the following error.

can't read proc table info

please help me
brian lee
harry d brown jr
Honored Contributor

Re: Open files per process

are you root ?

Is the OS HPux 11i (11.11v1) ?

What would you say your patch level is on your system ?

live free or die
harry
Live Free or Die
Brian Lee_4
Regular Advisor

Re: Open files per process

yes, it is 11iv1
patch: sep, 2003
brian lee