I have a server application which I think is leaking file handles.
I want to track the usage of file descriptors over time on my Linux (ubuntu) server.
I've figured out that I can track the number of file descriptors in use by a process with
lsof -p `pgrep the-process-name` | wc -l
Since I'm already using sysstat and sar to track various metrics, I thought it'd be nice to display with sar. I want to measure this every 10 minutes. Is it possible to add a custom metric to sar? Then I can easily report it out.
If not, I'll write a simple cron job to collect this data and store it separately in a log file.