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 open files

Rating
3 votes
Favoured:
0
Hits
168853
Files:
FileDescription
check_open_files.plversion 0.3
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!
A very simple script to check the number of opened files on system (linux of course..).
My old linux boxes sometimes hung because of a \"too many open files\". This plugin has been created to prevent this kind of crash.
Reviews (2)
byPotucek, September 18, 2012
This is a nice way of checking against SYSTEM limits but often when you run into the "too many open files" issues you actually have a problem with ulimit and would want to check a fixed file number.

Suggested patch:

--- check_open_files.pl 2012-09-18 10:54:38.000000000 -0600
+++ check_open_files.pl.orig 2012-09-18 10:42:49.000000000 -0600
@@ -35,19 +35,8 @@
# the first field minus the second one
my $realfreehandlers = $nb_openfiles - $nb_freehandlers;

-### Use the lowest number to alert on
-$warning_threshold=$file_max;
-$critical_threshold=$file_max;
-
-$warning_threshold=$opt_W
- if defined($opt_W);
-$critical_threshold=$opt_C
- if defined($opt_C);
-
-$warning_threshold=int($file_max * $opt_w /100)
- if defined($opt_w) && int($file_max * $opt_w /100) \$opt_c, "critical=s" => \$opt_c, # critical if above this percentage of system max
- "W=s" => \$opt_W, "warnabs=s" => \$opt_W, # warning if above this number
- "C=s" => \$opt_C, "critabs=s" => \$opt_C, # critical if above this number
+ "w=s" => \$opt_w, "warning=s" => \$opt_w, # warning if above this number
+ "c=s" => \$opt_c, "critical=s" => \$opt_c, # critical if above this number
"t=i" => \$opt_t, "timeout=i" => \$opt_t,
"h" => \$opt_h, "help" => \$opt_h,
"v" => \$opt_v, "version" => \$opt_v
@@ -88,12 +75,12 @@
unless (defined $opt_t){
$opt_t = $utils::TIMEOUT;
}
- unless ((defined $opt_w && defined $opt_c)||(defined $opt_W && defined $opt_C)){
+ unless (defined $opt_w && defined $opt_c){
print_usage();
exit $ERRORS{'UNKNOWN'};
}
- if ((defined($opt_w) && ( $opt_w >= $opt_c)) || (defined($opt_w) && ( $opt_W >= $opt_C))) {
- print "Warning (-w/W) cannot be greater than Critical (-c/C)!\n";
+ if ( $opt_w >= $opt_c) {
+ print "Warning (-w) cannot be greater than Critical (-c)!\n";
exit $ERRORS{'UNKNOWN'};
}
return $ERRORS{'OK'};
@@ -115,8 +102,6 @@
print " Checks the open files number against the max autorized\n";
print "-w (--warning) = Percentage of opened files to generate warning alert\n";
print "-c (--critical) = Percentage of opened files to generate critical( w
If you get any error of NRPE server as "NRPE: Unable to read output" when you run this plugins, please add a line into the check_open_files.pl as below:

use lib "/usr/local/nagios/libexec";

Because NRPE run this command by user nagios and it may need a path of file "utils.pm".