summaryrefslogtreecommitdiffstats
path: root/plugins-scripts/t/check_file_age.t
diff options
context:
space:
mode:
authorJan Wagner <waja@cyconet.org>2013-09-30 23:38:45 (GMT)
committerJan Wagner <waja@cyconet.org>2014-01-24 19:43:01 (GMT)
commit0b9b300f856d021b56950030f4e6053d84bc77c8 (patch)
tree57191e44659a3306616788d63a9ec977d13fd0c1 /plugins-scripts/t/check_file_age.t
parent455fe96e7dcadd433973b1709ee79cdb58ffe428 (diff)
downloadmonitoring-plugins-0b9b300.tar.gz
check_file_age: support for --ignore-missing
Patch to provide for a -i | --ignore-missing option. This allows files that don't exist to be monitored for without causing an error. The use case is: * one process periodically pushes files to an "input" queue for a second process * the second process, when running cleanly will "consume" (process and remove) these files So the conditions to meet are: 1. If the file doesn't exist, that's fine (OK) 2. If the file exists, but is less than X seconds, that's fine (OK) 3. If the file exists, but greater than X seconds, no good (CRITICAL) Since now check_file_age doesn't permit this behavior, as a non-existent file is considered CRITICAL. Test case was contributed by our lovely Holger. Closes #1181, Closes #989, Closes #862, Closes #1187, Closes #845 Closes Debian Bug #496307
Diffstat (limited to 'plugins-scripts/t/check_file_age.t')
-rw-r--r--plugins-scripts/t/check_file_age.t7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins-scripts/t/check_file_age.t b/plugins-scripts/t/check_file_age.t
index 384c276..a515649 100644
--- a/plugins-scripts/t/check_file_age.t
+++ b/plugins-scripts/t/check_file_age.t
@@ -5,7 +5,7 @@
5# 5#
6 6
7use strict; 7use strict;
8use Test::More tests => 15; 8use Test::More tests => 16;
9use NPTest; 9use NPTest;
10 10
11my $successOutput = '/^FILE_AGE OK: /'; 11my $successOutput = '/^FILE_AGE OK: /';
@@ -58,6 +58,11 @@ $result = NPTest->testCmd(
58cmp_ok( $result->return_code, '==', 0, "Checking file size" ); 58cmp_ok( $result->return_code, '==', 0, "Checking file size" );
59 59
60$result = NPTest->testCmd( 60$result = NPTest->testCmd(
61 "./check_file_age -f /non/existent --ignore-missing"
62 );
63cmp_ok( $result->return_code, '==', 0, "Honours --ignore-missing" );
64
65$result = NPTest->testCmd(
61 "./check_file_age -f $temp_file -c 1000 -W 101" 66 "./check_file_age -f $temp_file -c 1000 -W 101"
62 ); 67 );
63cmp_ok( $result->return_code, '==', 1, "One byte too short" ); 68cmp_ok( $result->return_code, '==', 1, "One byte too short" );