diff options
author | Andreas Motl <andreas.motl@elmyra.de> | 2022-02-12 14:41:54 +0100 |
---|---|---|
committer | Sven Nierlein <sven@nierlein.org> | 2022-02-15 16:09:47 +0100 |
commit | c99a166a43fb9da42ba68073224921124a435aab (patch) | |
tree | 559d6b1a6dd822004d5f1e2becf822ed7838edea /plugins-scripts/t | |
parent | 5943528121033579033c5a372df6c5e91b22e723 (diff) | |
download | monitoring-plugins-c99a166a43fb9da42ba68073224921124a435aab.tar.gz |
check_uptime: Add option to report uptime in days instead of seconds
Currently, the plugin output is:
CRITICAL: Uptime is 38829029 seconds.
When using the proposed `--days|-d` option, it will be:
CRITICAL: Uptime is 449 days.
Diffstat (limited to 'plugins-scripts/t')
-rw-r--r-- | plugins-scripts/t/check_uptime.t | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins-scripts/t/check_uptime.t b/plugins-scripts/t/check_uptime.t index c395307c..b31d0c6c 100644 --- a/plugins-scripts/t/check_uptime.t +++ b/plugins-scripts/t/check_uptime.t | |||
@@ -5,7 +5,7 @@ | |||
5 | # | 5 | # |
6 | 6 | ||
7 | use strict; | 7 | use strict; |
8 | use Test::More tests => 40; | 8 | use Test::More tests => 42; |
9 | use NPTest; | 9 | use NPTest; |
10 | 10 | ||
11 | my $result; | 11 | my $result; |
@@ -46,6 +46,12 @@ cmp_ok( $result->return_code, '==', 2, "Uptime higher than 2 seconds" ); | |||
46 | like ( $result->output, '/Running since \d+/', "Output for the s parameter correct" ); | 46 | like ( $result->output, '/Running since \d+/', "Output for the s parameter correct" ); |
47 | 47 | ||
48 | $result = NPTest->testCmd( | 48 | $result = NPTest->testCmd( |
49 | "./check_uptime -d -w 1 -c 2" | ||
50 | ); | ||
51 | cmp_ok( $result->return_code, '==', 2, "Uptime higher than 2 seconds" ); | ||
52 | like ( $result->output, '/CRITICAL: uptime is \d+ days/', "Output for the d parameter correct" ); | ||
53 | |||
54 | $result = NPTest->testCmd( | ||
49 | "./check_uptime -w 1 -c 2" | 55 | "./check_uptime -w 1 -c 2" |
50 | ); | 56 | ); |
51 | cmp_ok( $result->return_code, '==', 2, "Uptime higher than 2 seconds" ); | 57 | cmp_ok( $result->return_code, '==', 2, "Uptime higher than 2 seconds" ); |