diff options
author | Jonas Genannt <jonas@brachium-system.net> | 2014-09-23 12:51:55 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2014-10-06 20:16:00 +0200 |
commit | 3b02d7fafba6ef35cac9af47ce046f9c7a6fc510 (patch) | |
tree | 6ef6f29b759aa1bccd5b982a68a9963b37b072a4 /plugins-scripts/check_file_age.pl | |
parent | 849eb5725c28acabab5d08266a4ee8b905c81a0c (diff) | |
download | monitoring-plugins-3b02d7fafba6ef35cac9af47ce046f9c7a6fc510.tar.gz |
check_file_age: Provide performance data
Diffstat (limited to 'plugins-scripts/check_file_age.pl')
-rwxr-xr-x | plugins-scripts/check_file_age.pl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins-scripts/check_file_age.pl b/plugins-scripts/check_file_age.pl index 453e0f55..4415fdf4 100755 --- a/plugins-scripts/check_file_age.pl +++ b/plugins-scripts/check_file_age.pl | |||
@@ -34,7 +34,7 @@ sub print_help (); | |||
34 | sub print_usage (); | 34 | sub print_usage (); |
35 | 35 | ||
36 | my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V, $opt_i); | 36 | my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V, $opt_i); |
37 | my ($result, $message, $age, $size, $st); | 37 | my ($result, $message, $age, $size, $st, $perfdata); |
38 | 38 | ||
39 | $PROGNAME="check_file_age"; | 39 | $PROGNAME="check_file_age"; |
40 | 40 | ||
@@ -92,6 +92,7 @@ unless (-e $opt_f) { | |||
92 | $st = File::stat::stat($opt_f); | 92 | $st = File::stat::stat($opt_f); |
93 | $age = time - $st->mtime; | 93 | $age = time - $st->mtime; |
94 | $size = $st->size; | 94 | $size = $st->size; |
95 | $perfdata = "age=${age}s;${opt_w};${opt_c} size=${size}B;${opt_W};${opt_C};0"; | ||
95 | 96 | ||
96 | 97 | ||
97 | $result = 'OK'; | 98 | $result = 'OK'; |
@@ -103,7 +104,7 @@ elsif (($opt_w and $age > $opt_w) or ($opt_W and $size < $opt_W)) { | |||
103 | $result = 'WARNING'; | 104 | $result = 'WARNING'; |
104 | } | 105 | } |
105 | 106 | ||
106 | print "FILE_AGE $result: $opt_f is $age seconds old and $size bytes\n"; | 107 | print "FILE_AGE $result: $opt_f is $age seconds old and $size bytes | $perfdata\n"; |
107 | exit $ERRORS{$result}; | 108 | exit $ERRORS{$result}; |
108 | 109 | ||
109 | sub print_usage () { | 110 | sub print_usage () { |