summaryrefslogtreecommitdiffstats
path: root/plugins-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-scripts')
-rwxr-xr-xplugins-scripts/check_uptime.pl2
-rw-r--r--plugins-scripts/t/check_uptime.t16
2 files changed, 9 insertions, 9 deletions
diff --git a/plugins-scripts/check_uptime.pl b/plugins-scripts/check_uptime.pl
index 04324b2e..f9542872 100755
--- a/plugins-scripts/check_uptime.pl
+++ b/plugins-scripts/check_uptime.pl
@@ -150,7 +150,7 @@ if ( $opt_d ) {
150 150
151$msg = "$state_str: "; 151$msg = "$state_str: ";
152 152
153$msg .= "uptime is $uptime_text $uptime_unit. "; 153$msg .= "Uptime is $uptime_text $uptime_unit. ";
154$msg .= "Exceeds $out_of_bounds_text threshold. " if $out_of_bounds_text; 154$msg .= "Exceeds $out_of_bounds_text threshold. " if $out_of_bounds_text;
155$msg .= "Running for $pretty_uptime. " if $opt_f; 155$msg .= "Running for $pretty_uptime. " if $opt_f;
156if ( $opt_s ) { 156if ( $opt_s ) {
diff --git a/plugins-scripts/t/check_uptime.t b/plugins-scripts/t/check_uptime.t
index b31d0c6c..6e81db3c 100644
--- a/plugins-scripts/t/check_uptime.t
+++ b/plugins-scripts/t/check_uptime.t
@@ -49,32 +49,32 @@ $result = NPTest->testCmd(
49 "./check_uptime -d -w 1 -c 2" 49 "./check_uptime -d -w 1 -c 2"
50 ); 50 );
51cmp_ok( $result->return_code, '==', 2, "Uptime higher than 2 seconds" ); 51cmp_ok( $result->return_code, '==', 2, "Uptime higher than 2 seconds" );
52like ( $result->output, '/CRITICAL: uptime is \d+ days/', "Output for the d parameter correct" ); 52like ( $result->output, '/CRITICAL: Uptime is \d+ days/', "Output for the d parameter correct" );
53 53
54$result = NPTest->testCmd( 54$result = NPTest->testCmd(
55 "./check_uptime -w 1 -c 2" 55 "./check_uptime -w 1 -c 2"
56 ); 56 );
57cmp_ok( $result->return_code, '==', 2, "Uptime higher than 2 seconds" ); 57cmp_ok( $result->return_code, '==', 2, "Uptime higher than 2 seconds" );
58like ( $result->output, '/^CRITICAL: uptime is \d+ seconds/', "Output for uptime higher than 2 seconds correct" ); 58like ( $result->output, '/^CRITICAL: Uptime is \d+ seconds/', "Output for uptime higher than 2 seconds correct" );
59 59
60$result = NPTest->testCmd( 60$result = NPTest->testCmd(
61 "./check_uptime -w 1 -c 9999w" 61 "./check_uptime -w 1 -c 9999w"
62 ); 62 );
63cmp_ok( $result->return_code, '==', 1, "Uptime lower than 9999 weeks" ); 63cmp_ok( $result->return_code, '==', 1, "Uptime lower than 9999 weeks" );
64like ( $result->output, '/^WARNING: uptime is \d+ seconds/', "Output for uptime lower than 9999 weeks correct" ); 64like ( $result->output, '/^WARNING: Uptime is \d+ seconds/', "Output for uptime lower than 9999 weeks correct" );
65 65
66$result = NPTest->testCmd( 66$result = NPTest->testCmd(
67 "./check_uptime -w 9998w -c 9999w" 67 "./check_uptime -w 9998w -c 9999w"
68 ); 68 );
69cmp_ok( $result->return_code, '==', 0, "Uptime lower than 9998 weeks" ); 69cmp_ok( $result->return_code, '==', 0, "Uptime lower than 9998 weeks" );
70like ( $result->output, '/^OK: uptime is \d+ seconds/', "Output for uptime lower than 9998 weeks correct" ); 70like ( $result->output, '/^OK: Uptime is \d+ seconds/', "Output for uptime lower than 9998 weeks correct" );
71like ( $result->output, '/\|uptime=[0-9]+s;6046790400;6047395200;/', "Checking for performance output" ); 71like ( $result->output, '/\|uptime=[0-9]+s;6046790400;6047395200;/', "Checking for performance output" );
72 72
73$result = NPTest->testCmd( 73$result = NPTest->testCmd(
74 "./check_uptime -w 111222d -c 222333d" 74 "./check_uptime -w 111222d -c 222333d"
75 ); 75 );
76cmp_ok( $result->return_code, '==', 0, "Uptime lower than 111222 days" ); 76cmp_ok( $result->return_code, '==', 0, "Uptime lower than 111222 days" );
77like ( $result->output, '/^OK: uptime is \d+ seconds/', "Output for uptime lower than 111222 days correct" ); 77like ( $result->output, '/^OK: Uptime is \d+ seconds/', "Output for uptime lower than 111222 days correct" );
78like ( $result->output, '/\|uptime=[0-9]+s;9609580800;19209571200;/', "Checking for performance output" ); 78like ( $result->output, '/\|uptime=[0-9]+s;9609580800;19209571200;/', "Checking for performance output" );
79 79
80# Same as before, hopefully uptime is higher than 2 seconds so no warning 80# Same as before, hopefully uptime is higher than 2 seconds so no warning
@@ -82,7 +82,7 @@ $result = NPTest->testCmd(
82 "./check_uptime -w 2:111222d -c 1:222333d" 82 "./check_uptime -w 2:111222d -c 1:222333d"
83 ); 83 );
84cmp_ok( $result->return_code, '==', 0, "Uptime lower than 111222 days, and higher 2 seconds" ); 84cmp_ok( $result->return_code, '==', 0, "Uptime lower than 111222 days, and higher 2 seconds" );
85like ( $result->output, '/^OK: uptime is \d+ seconds/', "Output for uptime lower than 111222 days, and higher 2 seconds correct" ); 85like ( $result->output, '/^OK: Uptime is \d+ seconds/', "Output for uptime lower than 111222 days, and higher 2 seconds correct" );
86like ( $result->output, '/\|uptime=[0-9]+s;9609580800;19209571200;/', "Checking for performance output" ); 86like ( $result->output, '/\|uptime=[0-9]+s;9609580800;19209571200;/', "Checking for performance output" );
87 87
88# Same as before, now the low warning should trigger 88# Same as before, now the low warning should trigger
@@ -90,7 +90,7 @@ $result = NPTest->testCmd(
90 "./check_uptime -w 111221d:111222d -c 1:222333d" 90 "./check_uptime -w 111221d:111222d -c 1:222333d"
91 ); 91 );
92cmp_ok( $result->return_code, '==', 1, "Uptime lower than 111221 days raises warning" ); 92cmp_ok( $result->return_code, '==', 1, "Uptime lower than 111221 days raises warning" );
93like ( $result->output, '/^WARNING: uptime is \d+ seconds/', "Output for uptime lower than 111221 days correct" ); 93like ( $result->output, '/^WARNING: Uptime is \d+ seconds/', "Output for uptime lower than 111221 days correct" );
94like ( $result->output, '/Exceeds lower warn threshold/', "Exceeds text correct" ); 94like ( $result->output, '/Exceeds lower warn threshold/', "Exceeds text correct" );
95like ( $result->output, '/\|uptime=[0-9]+s;9609580800;19209571200;/', "Checking for performance output" ); 95like ( $result->output, '/\|uptime=[0-9]+s;9609580800;19209571200;/', "Checking for performance output" );
96 96
@@ -99,7 +99,7 @@ $result = NPTest->testCmd(
99 "./check_uptime -w 111221d:111222d -c 111220d:222333d" 99 "./check_uptime -w 111221d:111222d -c 111220d:222333d"
100 ); 100 );
101cmp_ok( $result->return_code, '==', 2, "Uptime lower than 111220 days raises critical" ); 101cmp_ok( $result->return_code, '==', 2, "Uptime lower than 111220 days raises critical" );
102like ( $result->output, '/^CRITICAL: uptime is \d+ seconds/', "Output for uptime lower than 111220 days correct" ); 102like ( $result->output, '/^CRITICAL: Uptime is \d+ seconds/', "Output for uptime lower than 111220 days correct" );
103like ( $result->output, '/Exceeds lower crit threshold/', "Exceeds text correct" ); 103like ( $result->output, '/Exceeds lower crit threshold/', "Exceeds text correct" );
104like ( $result->output, '/\|uptime=[0-9]+s;9609580800;19209571200;/', "Checking for performance output" ); 104like ( $result->output, '/\|uptime=[0-9]+s;9609580800;19209571200;/', "Checking for performance output" );
105 105