Home Directory

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

Directory

Potucek

Reviews(1)
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