summaryrefslogtreecommitdiffstats
path: root/plugins-scripts/check_file_age.pl
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-scripts/check_file_age.pl')
-rwxr-xr-xplugins-scripts/check_file_age.pl6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins-scripts/check_file_age.pl b/plugins-scripts/check_file_age.pl
index 453e0f5..15330f7 100755
--- a/plugins-scripts/check_file_age.pl
+++ b/plugins-scripts/check_file_age.pl
@@ -27,14 +27,13 @@ use File::stat;
27use vars qw($PROGNAME); 27use vars qw($PROGNAME);
28use FindBin; 28use FindBin;
29use lib "$FindBin::Bin"; 29use lib "$FindBin::Bin";
30use lib '@libexecdir@';
31use utils qw (%ERRORS &print_revision &support); 30use utils qw (%ERRORS &print_revision &support);
32 31
33sub print_help (); 32sub print_help ();
34sub print_usage (); 33sub print_usage ();
35 34
36my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V, $opt_i); 35my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V, $opt_i);
37my ($result, $message, $age, $size, $st); 36my ($result, $message, $age, $size, $st, $perfdata);
38 37
39$PROGNAME="check_file_age"; 38$PROGNAME="check_file_age";
40 39
@@ -92,6 +91,7 @@ unless (-e $opt_f) {
92$st = File::stat::stat($opt_f); 91$st = File::stat::stat($opt_f);
93$age = time - $st->mtime; 92$age = time - $st->mtime;
94$size = $st->size; 93$size = $st->size;
94$perfdata = "age=${age}s;${opt_w};${opt_c} size=${size}B;${opt_W};${opt_C};0";
95 95
96 96
97$result = 'OK'; 97$result = 'OK';
@@ -103,7 +103,7 @@ elsif (($opt_w and $age > $opt_w) or ($opt_W and $size < $opt_W)) {
103 $result = 'WARNING'; 103 $result = 'WARNING';
104} 104}
105 105
106print "FILE_AGE $result: $opt_f is $age seconds old and $size bytes\n"; 106print "FILE_AGE $result: $opt_f is $age seconds old and $size bytes | $perfdata\n";
107exit $ERRORS{$result}; 107exit $ERRORS{$result};
108 108
109sub print_usage () { 109sub print_usage () {