summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6628ad2)
raw | patch | inline | side by side (parent: 6628ad2)
author | Ton Voon <tonvoon@users.sourceforge.net> | |
Mon, 8 Jan 2007 11:05:55 +0000 (11:05 +0000) | ||
committer | Ton Voon <tonvoon@users.sourceforge.net> | |
Mon, 8 Jan 2007 11:05:55 +0000 (11:05 +0000) |
same when mount points reversed
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1565 f882894a-f735-0410-b71e-b25c423dba1c
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1565 f882894a-f735-0410-b71e-b25c423dba1c
CHANGES | patch | blob | history | |
THANKS.in | patch | blob | history | |
plugins/t/check_disk.t | patch | blob | history |
index 3f5c0a69fd4f0a4f746d2a85cb676f5deeebd895..d1abed0bb151bb967ae74f38bb7e011d465edbc2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
Fixed Solaris problems with check_swap (tested on Solaris 9)
Fixed check_swap for HP/UX where swapinfo command was incorrect
Fixed check_disk inode threshold checks, regressed at r1.4.4.
+ Fixed crit/warn for check_disk perf data
1.4.5
Fixed bug in perl's is_hostname routine
diff --git a/THANKS.in b/THANKS.in
index 031cc4a87c3855445590e7574c76528ec9c77021..01fc4587eb50ee5283e36d352b7b0ce6a9199bef 100644 (file)
--- a/THANKS.in
+++ b/THANKS.in
Duncan Ferguson
Dick van den Burg
Matthias Eble
+Sebastian Schubert
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t
index dd4fcee4789bcf8fd4e07298dcead560072b7751..50d2e6d5016520da54619dd077a65ebbf5c2f735 100644 (file)
--- a/plugins/t/check_disk.t
+++ b/plugins/t/check_disk.t
if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") {
plan skip_all => "Need 2 mountpoints to test";
} else {
- plan tests => 56;
+ plan tests => 57;
}
$result = NPTest->testCmd(
$c++ while /\(/g; # counts number of "(" - should be two
cmp_ok( $c, '==', 2, "Got two mountpoints in output");
+
+# Get perf data
+# Should use Nagios::Plugin
+my @perf_data = sort(split(/ /, $result->perf_output));
+
+
# Calculate avg_free free on mountpoint1 and mountpoint2
# because if you check in the middle, you should get different errors
$_ = $result->output;
if ($free_inode_on_mp1 > $free_inode_on_mp2) {
$more_inode_free = $mountpoint_valid;
$less_inode_free = $mountpoint2_valid;
-} elsif ($free_on_mp1 < $free_on_mp2) {
+} elsif ($free_inode_on_mp1 < $free_inode_on_mp2) {
$more_inode_free = $mountpoint2_valid;
$less_inode_free = $mountpoint_valid;
} else {
-# Basic filesystem checks for sizes
+# Check when order of mount points are reversed, that perf data remains same
+$result = NPTest->testCmd(
+ "./check_disk -w 1% -c 1% -p $mountpoint2_valid -w 1% -c 1% -p $mountpoint_valid"
+ );
+@_ = sort(split(/ /, $result->perf_output));
+is_deeply( \@perf_data, \@_, "perf data for both filesystems same when reversed");
+
+# Basic filesystem checks for sizes
$result = NPTest->testCmd( "./check_disk -w 1 -c 1 -p $more_free" );
cmp_ok( $result->return_code, '==', 0, "At least 1 MB available on $more_free");
like ( $result->output, $successOutput, "OK output" );
"./check_disk -e -w $avg_free% -c 0% -p $less_free -w $avg_free% -c $avg_free% -p $more_free"
);
isnt( $result->output, $all_disks, "-e gives different output");
-like( $result->output, qr/$less_free/, "Found problem $less_free");
-unlike( $result->only_output, qr/$more_free/, "Has ignored $more_free as not a problem");
-like( $result->perf_output, qr/$more_free/, "But $more_free is still in perf data");
+
+# Need spaces around filesystem name in case less_free and more_free are nested
+like( $result->output, qr/ $less_free /, "Found problem $less_free");
+unlike( $result->only_output, qr/ $more_free /, "Has ignored $more_free as not a problem");
+like( $result->perf_output, qr/ $more_free=/, "But $more_free is still in perf data");
$result = NPTest->testCmd(
"./check_disk -w $avg_free% -c 0% -p $more_free"