--- check_file_age.pl Wed Jun 8 05:29:07 2005 +++ /usr/local/libexec/nagios/check_file_age Wed Jun 8 05:25:19 2005 @@ -33,7 +33,7 @@ sub print_help (); sub print_usage (); -my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V); +my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V, $opt_n); my ($result, $message, $age, $size, $st); $PROGNAME="check_file_age"; @@ -52,7 +52,8 @@ "w=f" => \$opt_w, "warning-age=f" => \$opt_w, "W=f" => \$opt_W, "warning-size=f" => \$opt_W, "c=f" => \$opt_c, "critical-age=f" => \$opt_c, - "C=f" => \$opt_C, "critical-size=f" => \$opt_C); + "C=f" => \$opt_C, "critical-size=f" => \$opt_C, + "n" => \$opt_n, "no_file_ok" => \$opt_n); if ($opt_V) { print_revision($PROGNAME, '$Id: check_file_age.pl,v 1.2 2003/10/21 15:56:35 tonvoon Exp $'); @@ -74,6 +75,9 @@ # Examine the file. unless (-f $opt_f) { print "$opt_f: File not found\n"; + if ($opt_n) { + exit $ERRORS{'OK'}; + } exit $ERRORS{'UNKNOWN'}; } @@ -96,7 +100,7 @@ sub print_usage () { print "Usage:\n"; - print " $PROGNAME [-w ] [-c ] [-W ] [-C ] -f \n"; + print " $PROGNAME [-w ] [-c ] [-W ] [-C ] -n -f \n"; print " $PROGNAME [-h | --help]\n"; print " $PROGNAME [-V | --version]\n"; } @@ -108,6 +112,7 @@ print "\n"; print " File must be no more than this many seconds old\n"; print " File must be at least this many bytes long\n"; + print " use -n if you don\'t want an error condition for file not found\n"; print "\n"; support(); }