From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- .../319236-check_file_age--allow_missing_file.diff | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 web/attachments/319236-check_file_age--allow_missing_file.diff (limited to 'web/attachments/319236-check_file_age--allow_missing_file.diff') diff --git a/web/attachments/319236-check_file_age--allow_missing_file.diff b/web/attachments/319236-check_file_age--allow_missing_file.diff new file mode 100644 index 0000000..6e51a5a --- /dev/null +++ b/web/attachments/319236-check_file_age--allow_missing_file.diff @@ -0,0 +1,37 @@ +--- a/check_file_age 2008-12-29 07:54:29.000000000 -0800 ++++ b/check_file_age 2009-03-23 22:35:54.000000000 -0700 +@@ -33,7 +33,7 @@ use utils qw (%ERRORS &print_revision &s + 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_m, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V); + my ($result, $message, $age, $size, $st); + + $PROGNAME="check_file_age"; +@@ -48,6 +48,7 @@ Getopt::Long::Configure('bundling'); + GetOptions( + "V" => \$opt_V, "version" => \$opt_V, + "h" => \$opt_h, "help" => \$opt_h, ++ "m" => \$opt_m, "missing" => \$opt_m, + "f=s" => \$opt_f, "file" => \$opt_f, + "w=f" => \$opt_w, "warning-age=f" => \$opt_w, + "W=f" => \$opt_W, "warning-size=f" => \$opt_W, +@@ -73,8 +74,14 @@ if (! $opt_f) { + + # Check that file exists (can be directory or link) + unless (-e $opt_f) { +- print "FILE_AGE CRITICAL: File not found - $opt_f\n"; +- exit $ERRORS{'CRITICAL'}; ++ # If we allow missing files/directories, return OK ++ if ($opt_m) { ++ print "FILE_AGE OK: File not found - $opt_f\n"; ++ exit $ERRORS{'OK'}; ++ } else { ++ print "FILE_AGE CRITICAL: File not found - $opt_f\n"; ++ exit $ERRORS{'CRITICAL'}; ++ } + } + + $st = File::stat::stat($opt_f); + -- cgit v1.2.3-74-g34f1