Tracking Too Many Files Open or Too Many File Handles Open

Looking for a way to use the Infrastructure tool and the AWS integration to be able to track file handles and having too many open in NR. Ideally when we hit a threshold we would alert and can mitigate. We are alerted when from APM when we see an error, but then have to dig into it to find out too many files are open…want to see if there is a way to warn and predict before we get to the point of too many and the service/server begins to error out.

Thanks as always!

Hi @david95,

The Infrastructure agent currently doesn’t natively support counting the number of open files on a system, but you could write a custom integration for the agent that could collect that number and report it. It could be as simple as writing a short shell script that runs lsof and encodes the result into JSON.

This would make a great feature idea!


Just wanted to emphasise that it it very important metric also for us and it is kinda sad that such a basic thing is not supported out-of-the-box. The custom integration seams to be quite advanced and not intended for general DevOps use and quick implementations (I can add custom metrics monitoring in Zabbix by adding one line to config file).

@gatis.spats - Thanks for commenting - I’ve got your +1 added.

I just got here as I too was looking to see how NewRelic might help us monitor file handles and whether we have an issue there. I was hoping the infrastructure agent might do this (as we haven’t got it installed on a legacy server yet), so a bit sad to see its not the case.

I’m wondering if there are any easy examples for doing this in a shell script or if we have to resort to a fuller language (a quick and dirty shell script would help)

This seems like something the Flex integration could do for you!

There are some example Flex configs here:

you’ll see some in there that operate on files, and file counts. This should help get you the data you need.

See here for more on Flex:

1 Like