[Nagiosplug-devel] [Patch] check_inodes-freebsd.pl 1.1 (Nagios-Plugin 1.4)
Johann Henriquez
jmhenril at gmail.com
Sat Jun 4 18:25:41 CEST 2005
--- check_inodes-freebsd.pl Wed Jun 1 18:59:12 2005
+++ check_inodes-freebsd.pl Sat Jun 4 18:41:29 2005
@@ -4,7 +4,7 @@
# Designed on FreeBSD 4.6 (although this should not matter)
# parses df output, splits, and then takes variables
# df.pl -f mountpoint -w warningnumber -c critical number
-# USE NUMBERS AND NOT PERCENTS FOR wanring and critical values
+# USE NUMBERS AND NOT PERCENTS FOR warning and critical values
# -h is help
# -v is version
# Mountpoints:
@@ -15,7 +15,7 @@
use strict;
use Getopt::Long;
use vars qw($opt_V $opt_h $opt_w $opt_c $opt_f $verbose $PROGNAME);
-use lib "/usr/local/libexec/nagios" ;
+use lib "/usr/local/nagios/libexec" ;
use utils qw($TIMEOUT %ERRORS &print_revision &support);
my $df = "/bin/df";
@@ -91,15 +91,15 @@
my
($fs,$onek,$used,$avail,$capacity,$iused,$ifree,$ipercent,$mounted) =
split;
$ipercent =~ s/%//s;
- if ($ipercent > $opt_w) {
+ if ($ipercent > $opt_c) {
+ $state = $ERRORS{'CRITICAL'};
+ $answer = "CRITICAL: $ipercent
percent inodes used on $opt_f\n";
+ } elsif ($ipercent >= $opt_w) {
$state = $ERRORS{'WARNING'};
- $answer = "WARNING: $ipercent percent
inodes free on $opt_f\n";
- } elsif ($ipercent > $opt_w) {
- $state = $ERRORS{'CRITCAL'};
- $answer = "CRITICAL: $ipercent
percent inodes free on $opt_f\n";
+ $answer = "WARNING: $ipercent percent
inodes used on $opt_f\n";
} elsif ($ipercent < $opt_w) {
$state = $ERRORS{'OK'};
- $answer = "OK: $ipercent percent
inodes free on $opt_f\n";
+ $answer = "OK: $ipercent percent
inodes used on $opt_f\n";
}
}
@@ -109,8 +109,8 @@
exit $state;
sub print_usage () {
- print "Usage: $PROGNAME <filesystem> [-w <warn>] [-c <crit>]\n";
- print "Example: $PROGNAME /dev/ad0s1a -w 50 -c 75\n";
+ print "Usage: $PROGNAME -f <filesystem> [-w <warn>] [-c <crit>]\n";
+ print "Example: $PROGNAME -f /usr -w 50 -c 75\n";
}
sub print_help () {
--
regards,
Johann Henriquez Lucero
More information about the Devel
mailing list