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.

1 Answer 1


It's not possible to add another metric without modifying the source code of sar.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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