diff options
Diffstat (limited to 'plugins-scripts/check_file_age.pl')
-rwxr-xr-x | plugins-scripts/check_file_age.pl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins-scripts/check_file_age.pl b/plugins-scripts/check_file_age.pl index 43038fae..0215c0f6 100755 --- a/plugins-scripts/check_file_age.pl +++ b/plugins-scripts/check_file_age.pl | |||
@@ -67,14 +67,14 @@ if ($opt_h) { | |||
67 | $opt_f = shift unless ($opt_f); | 67 | $opt_f = shift unless ($opt_f); |
68 | 68 | ||
69 | if (! $opt_f) { | 69 | if (! $opt_f) { |
70 | print "No file specified\n"; | 70 | print "FILE_AGE UNKNOWN: No file specified\n"; |
71 | exit $ERRORS{'UNKNOWN'}; | 71 | exit $ERRORS{'UNKNOWN'}; |
72 | } | 72 | } |
73 | 73 | ||
74 | # Examine the file. | 74 | # Check that file exists (can be directory or link) |
75 | unless (-f $opt_f) { | 75 | unless (-e $opt_f) { |
76 | print "$opt_f: File not found\n"; | 76 | print "FILE_AGE CRITICAL: File not found - $opt_f\n"; |
77 | exit $ERRORS{'UNKNOWN'}; | 77 | exit $ERRORS{'CRITICAL'}; |
78 | } | 78 | } |
79 | 79 | ||
80 | $st = File::stat::stat($opt_f); | 80 | $st = File::stat::stat($opt_f); |
@@ -91,7 +91,7 @@ elsif (($opt_w and $age > $opt_w) or ($opt_W and $size < $opt_W)) { | |||
91 | $result = 'WARNING'; | 91 | $result = 'WARNING'; |
92 | } | 92 | } |
93 | 93 | ||
94 | print "$result - $opt_f is $age seconds old and $size bytes\n"; | 94 | print "FILE_AGE $result: $opt_f is $age seconds old and $size bytes\n"; |
95 | exit $ERRORS{$result}; | 95 | exit $ERRORS{$result}; |
96 | 96 | ||
97 | sub print_usage () { | 97 | sub print_usage () { |
@@ -106,8 +106,8 @@ sub print_help () { | |||
106 | print "Copyright (c) 2003 Steven Grimm\n\n"; | 106 | print "Copyright (c) 2003 Steven Grimm\n\n"; |
107 | print_usage(); | 107 | print_usage(); |
108 | print "\n"; | 108 | print "\n"; |
109 | print " <secs> File must be no more than this many seconds old\n"; | 109 | print " <secs> File must be no more than this many seconds old (default: warn 240 secs, crit 600)\n"; |
110 | print " <size> File must be at least this many bytes long\n"; | 110 | print " <size> File must be at least this many bytes long (default: crit 0 bytes)\n"; |
111 | print "\n"; | 111 | print "\n"; |
112 | support(); | 112 | support(); |
113 | } | 113 | } |