I'm looking for a tool which can monitor whether a process is near limit of maximum open files.

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted
lsof -p process-id

From the man page

Lsof lists on its standard output file information about files opened by processes

[...]

       -p s     This option excludes or selects the listing of files  for  the
                processes  whose optional process IDentification (PID) numbers
                are  in  the  comma-separated  set  s  -  e.g.,   ``123''   or
                ``123,^456''.  (There should be no spaces in the set.)

                PID  numbers  that  begin with `^' (negation) represent exclu-
                sions.

                Multiple process ID numbers are joined in a  single  ORed  set
                before  participating  in  AND option selection.  However, PID
                exclusions are applied without ORing or ANDing and take effect
                before other selection criteria are applied.

[...]

       +|-r [t[m]]
                This option puts lsof in repeat mode.  There lsof  lists  open
                files  as selected by other options, delays t seconds (default
                fifteen), then  repeats  the  listing,  delaying  and  listing
                repetitively  until stopped by a condition defined by the pre-
                fix to the option.

                If the prefix is a `-', repeat mode is endless.  Lsof must  be
                terminated with an interrupt or quit signal.

                If  the prefix is `+', repeat mode will end the first cycle no
                open files are listed
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.