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
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_proc_files

Rating
0 votes
Favoured:
0
Current Version
1.1
Last Release Date
2012-09-16
Compatible With
  • Nagios 3.x
Owner
Hits
51371
Files:
FileDescription
check_proc_filescheck_proc_files
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
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.

Usage
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.