diff options
Diffstat (limited to 'plugins/t/check_disk.t')
| -rw-r--r-- | plugins/t/check_disk.t | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index 7e0f74b7..ec527e7f 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t | |||
| @@ -88,8 +88,9 @@ $result = NPTest->testCmd( | |||
| 88 | ); | 88 | ); |
| 89 | $_ = $result->perf_output; | 89 | $_ = $result->perf_output; |
| 90 | my ($warn_absth_data, $crit_absth_data, $total_absth_data) = (m/=.[^;]*;(\d+);(\d+);\d+;(\d+)/); | 90 | my ($warn_absth_data, $crit_absth_data, $total_absth_data) = (m/=.[^;]*;(\d+);(\d+);\d+;(\d+)/); |
| 91 | is ($warn_absth_data, $total_absth_data - 20, "Wrong warning in perf data using absolute thresholds"); | 91 | # default unit is MiB, but perfdata is always bytes |
| 92 | is ($crit_absth_data, $total_absth_data - 10, "Wrong critical in perf data using absolute thresholds"); | 92 | is ($warn_absth_data, $total_absth_data - (20 * (2 ** 20)), "Wrong warning in perf data using absolute thresholds"); |
| 93 | is ($crit_absth_data, $total_absth_data - (10 * (2 ** 20)), "Wrong critical in perf data using absolute thresholds"); | ||
| 93 | 94 | ||
| 94 | # Then check percent thresholds. | 95 | # Then check percent thresholds. |
| 95 | $result = NPTest->testCmd( | 96 | $result = NPTest->testCmd( |
| @@ -119,7 +120,7 @@ like ( $result->only_output, qr/$more_free/, "Have disk name in text"); | |||
| 119 | $result = NPTest->testCmd( "./check_disk -w 1 -c 1 -p $more_free -p $less_free" ); | 120 | $result = NPTest->testCmd( "./check_disk -w 1 -c 1 -p $more_free -p $less_free" ); |
| 120 | cmp_ok( $result->return_code, '==', 0, "At least 1 MB available on $more_free and $less_free"); | 121 | cmp_ok( $result->return_code, '==', 0, "At least 1 MB available on $more_free and $less_free"); |
| 121 | $_ = $result->output; | 122 | $_ = $result->output; |
| 122 | my ($free_mb_on_mp1, $free_mb_on_mp2) = (m/(\d+) MB .* (\d+) MB /g); | 123 | my ($free_mb_on_mp1, $free_mb_on_mp2) = (m/(\d+)MiB .* (\d+)MiB /g); |
| 123 | my $free_mb_on_all = $free_mb_on_mp1 + $free_mb_on_mp2; | 124 | my $free_mb_on_all = $free_mb_on_mp1 + $free_mb_on_mp2; |
| 124 | 125 | ||
| 125 | 126 | ||
| @@ -248,11 +249,11 @@ $result = NPTest->testCmd( "./check_disk -w 100% -c 100% ".${mountpoint_valid} ) | |||
| 248 | cmp_ok( $result->return_code, "==", 2, "100% empty" ); | 249 | cmp_ok( $result->return_code, "==", 2, "100% empty" ); |
| 249 | like( $result->output, $failureOutput, "Right output" ); | 250 | like( $result->output, $failureOutput, "Right output" ); |
| 250 | 251 | ||
| 251 | $result = NPTest->testCmd( "./check_disk -w 100000 -c 100000 $mountpoint_valid" ); | 252 | $result = NPTest->testCmd( "./check_disk -w 100000000 -c 100000000 $mountpoint_valid" ); |
| 252 | cmp_ok( $result->return_code, '==', 2, "Check for 100GB free" ); | 253 | cmp_ok( $result->return_code, '==', 2, "Check for 100TB free" ); |
| 253 | 254 | ||
| 254 | $result = NPTest->testCmd( "./check_disk -w 100 -c 100 -u GB ".${mountpoint_valid} ); # 100 GB empty | 255 | $result = NPTest->testCmd( "./check_disk -w 100 -c 100 -u TB ".${mountpoint_valid} ); # 100 TB empty |
| 255 | cmp_ok( $result->return_code, "==", 2, "100 GB empty" ); | 256 | cmp_ok( $result->return_code, "==", 2, "100 TB empty" ); |
| 256 | 257 | ||
| 257 | 258 | ||
| 258 | # Checking old syntax of check_disk warn crit [fs], with warn/crit at USED% thresholds | 259 | # Checking old syntax of check_disk warn crit [fs], with warn/crit at USED% thresholds |
