From c99a166a43fb9da42ba68073224921124a435aab Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sat, 12 Feb 2022 14:41:54 +0100 Subject: 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. --- plugins-scripts/t/check_uptime.t | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'plugins-scripts/t') 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 @@ # use strict; -use Test::More tests => 40; +use Test::More tests => 42; use NPTest; my $result; @@ -45,6 +45,12 @@ $result = NPTest->testCmd( cmp_ok( $result->return_code, '==', 2, "Uptime higher than 2 seconds" ); like ( $result->output, '/Running since \d+/', "Output for the s parameter correct" ); +$result = NPTest->testCmd( + "./check_uptime -d -w 1 -c 2" + ); +cmp_ok( $result->return_code, '==', 2, "Uptime higher than 2 seconds" ); +like ( $result->output, '/CRITICAL: uptime is \d+ days/', "Output for the d parameter correct" ); + $result = NPTest->testCmd( "./check_uptime -w 1 -c 2" ); -- cgit v1.2.3-74-g34f1