Build precise queries to find exactly what you need
Press ESC to close
Nagios World Conference 2026: Sept. 14-17 in St. Paul, MN | Learn More
Your review has been submitted and is pending approval.
A very simple script to check the number of opened files on system (linux of course..).
Current Version
Last Release Date
June 16, 2009
Owner
Nagios Exchange
Download URL
https://exchange.nagios.org/wp-content/uploads/project-files/2009/06/check_open_files.pl
version 0.3
My old linux boxes sometimes hung because of a "too many open files". This plugin has been created to prevent this kind of crash.
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 autorizedn"; print "-w (--warning) = Percentage of opened files to generate warning alertn"; 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".
You must be logged in to submit a review.
To:
From: