Linux – Monitor open files limits, etc

limitslinuxmonitoring

We've been hitting the max open files limit on a few services recently. There are also a bunch of other limits in place. Is there a way to monitor how close processes are to these limits so we can be alerted when it's time to either up the limits or fix the root cause? On the same note, is it possible to view a log of these events so we know when a crash occurs it's because of hitting one of these limits?

Best Answer

Yes, you can. /proc/<pid>/fd lists all open file descriptors. Memory usage can be seen in /proc/<pid>/{maps,smaps}. Just browse thorugh /proc/<pid> a bit and google files you don't understand :)