Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1


Remember Me

Directory Tree


0 votes
Current Version
Last Release Date
Compatible With
  • Nagios 3.x
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Linux perl script reports max_files (soft) utilization percentage for a given process
check_proc_files is a perl script to report the file handle utilization for a given process as a percentage of max_files. The basic functionality is accomplished by matching a string to a process command (and optionally user) and counting the number of files listed under /proc/$PID/fd. Because /proc/*/fd is a Linux specific feature this script functions only on Linux systems.

Because /proc/*/fd is owned by the process user it is necessary for this script to run using setuid. Perl helps address the security issues here. There are no calls to external shells or apps. The only file access done is for read only. There are no prompts for user input.

The script requires a string to match to a process to check. It processes the first match so the string should be as specific as possible. It uses the process command found under /proc/*/cmdline in order to match a process (this is done to avoid using ps which requires an external call). The command stored there includes the entire command line of the process including all parameters, but any spaces there are replaced by NULL. The script makes an attempt to compensate for this by removing any spaces from the match string supplied, but thismay not always work. It is best to avoid using spaces in the matching string. In order to assist with matching the process the script also accepts a user name and matches only processed owned by that user. The only other command line parameters are -c and -w for the warning and critical levels.
Output file handle utilization is the percentage of the soft file limit in use by open files.