aboutsummaryrefslogtreecommitdiff
path: root/plugins/t/check_load.t
diff options
context:
space:
mode:
authorGravatar Lorenz <12514511+RincewindsHat@users.noreply.github.com> 2022-09-19 10:23:49 +0200
committerGravatar GitHub <noreply@github.com> 2022-09-19 10:23:49 +0200
commitb90a5757f77cdc0434fa3f45cf59c63b9e695d90 (patch)
treec8e491f00d5d55707f07a51a3ffaccd27b41de79 /plugins/t/check_load.t
parent80872917294340a1e399b8a100c5a81c4f719220 (diff)
downloadmonitoring-plugins-b90a5757f77cdc0434fa3f45cf59c63b9e695d90.tar.gz
Display total and scaled load values if check_load scales the values by number of CPUs (#1778)
* Renew copyright * Display more verbose output, if scaled load values are used * Actually use scaled value for determining status and print the fitting perfdata depending on input parameters * Add test cases for scaled mode
Diffstat (limited to 'plugins/t/check_load.t')
-rw-r--r--plugins/t/check_load.t15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/t/check_load.t b/plugins/t/check_load.t
index 60837ef6..bba8947c 100644
--- a/plugins/t/check_load.t
+++ b/plugins/t/check_load.t
@@ -11,10 +11,12 @@ use NPTest;
my $res;
my $loadValue = "[0-9]+\.?[0-9]+";
-my $successOutput = "/^LOAD OK - load average: $loadValue, $loadValue, $loadValue/";
-my $failureOutput = "/^LOAD CRITICAL - load average: $loadValue, $loadValue, $loadValue/";
+my $successOutput = "/^LOAD OK - total load average: $loadValue, $loadValue, $loadValue/";
+my $successScaledOutput = "/^LOAD OK - scaled load average: $loadValue, $loadValue, $loadValue - total load average: $loadValue, $loadValue, $loadValue/";
+my $failureOutput = "/^LOAD CRITICAL - total load average: $loadValue, $loadValue, $loadValue/";
+my $failurScaledOutput = "/^LOAD CRITICAL - scaled load average: $loadValue, $loadValue, $loadValue - total load average: $loadValue, $loadValue, $loadValue/";
-plan tests => 11;
+plan tests => 13;
$res = NPTest->testCmd( "./check_load -w 100,100,100 -c 100,100,100" );
cmp_ok( $res->return_code, 'eq', 0, "load not over 100");
@@ -26,7 +28,7 @@ like( $res->output, $failureOutput, "Output OK");
$res = NPTest->testCmd( "./check_load -r -w 0,0,0 -c 0,0,0" );
cmp_ok( $res->return_code, 'eq', 2, "Load over 0 with per cpu division");
-like( $res->output, $failureOutput, "Output OK");
+like( $res->output, $failurScaledOutput, "Output OK");
$res = NPTest->testCmd( "./check_load -w 100 -c 100,110" );
cmp_ok( $res->return_code, 'eq', 0, "Plugin can handle non-triplet-arguments");
@@ -34,3 +36,8 @@ like( $res->output, $successOutput, "Output OK");
like( $res->perf_output, "/load1=$loadValue;100.000;100.000/", "Test handling of non triplet thresholds (load1)");
like( $res->perf_output, "/load5=$loadValue;100.000;110.000/", "Test handling of non triplet thresholds (load5)");
like( $res->perf_output, "/load15=$loadValue;100.000;110.000/", "Test handling of non triplet thresholds (load15)");
+
+
+$res = NPTest->testCmd( "./check_load -w 100,100,100 -c 100,100,100 -r" );
+cmp_ok( $res->return_code, 'eq', 0, "load not over 100");
+like( $res->output, $successScaledOutput, "Output OK");