summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2007-01-08 11:05:55 +0000
committerTon Voon <tonvoon@users.sourceforge.net>2007-01-08 11:05:55 +0000
commit4734e245f0675411da64b5627b58bef10d9f1129 (patch)
tree3c3627d7da33642b8c5d213b46fc8f3158aa98c7
parent6628ad263a49b7646a8fc41b60487dca17c8fa78 (diff)
downloadmonitoring-plugins-4734e245f0675411da64b5627b58bef10d9f1129.tar.gz
Added notes about check_disk perf data fix. Added test to check perf data is
same when mount points reversed git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1565 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--CHANGES1
-rw-r--r--THANKS.in1
-rw-r--r--plugins/t/check_disk.t27
3 files changed, 23 insertions, 6 deletions
diff --git a/CHANGES b/CHANGES
index 3f5c0a69..d1abed0b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,7 @@ This file documents the major additions and syntax changes between releases.
6 Fixed Solaris problems with check_swap (tested on Solaris 9) 6 Fixed Solaris problems with check_swap (tested on Solaris 9)
7 Fixed check_swap for HP/UX where swapinfo command was incorrect 7 Fixed check_swap for HP/UX where swapinfo command was incorrect
8 Fixed check_disk inode threshold checks, regressed at r1.4.4. 8 Fixed check_disk inode threshold checks, regressed at r1.4.4.
9 Fixed crit/warn for check_disk perf data
9 10
101.4.5 111.4.5
11 Fixed bug in perl's is_hostname routine 12 Fixed bug in perl's is_hostname routine
diff --git a/THANKS.in b/THANKS.in
index 031cc4a8..01fc4587 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -204,3 +204,4 @@ Pawel Malachowski
204Duncan Ferguson 204Duncan Ferguson
205Dick van den Burg 205Dick van den Burg
206Matthias Eble 206Matthias Eble
207Sebastian Schubert
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t
index dd4fcee4..50d2e6d5 100644
--- a/plugins/t/check_disk.t
+++ b/plugins/t/check_disk.t
@@ -24,7 +24,7 @@ my $mountpoint2_valid = getTestParameter( "NP_MOUNTPOINT2_VALID", "Path to anoth
24if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { 24if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") {
25 plan skip_all => "Need 2 mountpoints to test"; 25 plan skip_all => "Need 2 mountpoints to test";
26} else { 26} else {
27 plan tests => 56; 27 plan tests => 57;
28} 28}
29 29
30$result = NPTest->testCmd( 30$result = NPTest->testCmd(
@@ -36,6 +36,12 @@ $_ = $result->output;
36$c++ while /\(/g; # counts number of "(" - should be two 36$c++ while /\(/g; # counts number of "(" - should be two
37cmp_ok( $c, '==', 2, "Got two mountpoints in output"); 37cmp_ok( $c, '==', 2, "Got two mountpoints in output");
38 38
39
40# Get perf data
41# Should use Nagios::Plugin
42my @perf_data = sort(split(/ /, $result->perf_output));
43
44
39# Calculate avg_free free on mountpoint1 and mountpoint2 45# Calculate avg_free free on mountpoint1 and mountpoint2
40# because if you check in the middle, you should get different errors 46# because if you check in the middle, you should get different errors
41$_ = $result->output; 47$_ = $result->output;
@@ -63,7 +69,7 @@ my ($more_inode_free, $less_inode_free);
63if ($free_inode_on_mp1 > $free_inode_on_mp2) { 69if ($free_inode_on_mp1 > $free_inode_on_mp2) {
64 $more_inode_free = $mountpoint_valid; 70 $more_inode_free = $mountpoint_valid;
65 $less_inode_free = $mountpoint2_valid; 71 $less_inode_free = $mountpoint2_valid;
66} elsif ($free_on_mp1 < $free_on_mp2) { 72} elsif ($free_inode_on_mp1 < $free_inode_on_mp2) {
67 $more_inode_free = $mountpoint2_valid; 73 $more_inode_free = $mountpoint2_valid;
68 $less_inode_free = $mountpoint_valid; 74 $less_inode_free = $mountpoint_valid;
69} else { 75} else {
@@ -72,8 +78,15 @@ if ($free_inode_on_mp1 > $free_inode_on_mp2) {
72 78
73 79
74 80
75# Basic filesystem checks for sizes 81# Check when order of mount points are reversed, that perf data remains same
82$result = NPTest->testCmd(
83 "./check_disk -w 1% -c 1% -p $mountpoint2_valid -w 1% -c 1% -p $mountpoint_valid"
84 );
85@_ = sort(split(/ /, $result->perf_output));
86is_deeply( \@perf_data, \@_, "perf data for both filesystems same when reversed");
87
76 88
89# Basic filesystem checks for sizes
77$result = NPTest->testCmd( "./check_disk -w 1 -c 1 -p $more_free" ); 90$result = NPTest->testCmd( "./check_disk -w 1 -c 1 -p $more_free" );
78cmp_ok( $result->return_code, '==', 0, "At least 1 MB available on $more_free"); 91cmp_ok( $result->return_code, '==', 0, "At least 1 MB available on $more_free");
79like ( $result->output, $successOutput, "OK output" ); 92like ( $result->output, $successOutput, "OK output" );
@@ -116,9 +129,11 @@ $result = NPTest->testCmd(
116 "./check_disk -e -w $avg_free% -c 0% -p $less_free -w $avg_free% -c $avg_free% -p $more_free" 129 "./check_disk -e -w $avg_free% -c 0% -p $less_free -w $avg_free% -c $avg_free% -p $more_free"
117 ); 130 );
118isnt( $result->output, $all_disks, "-e gives different output"); 131isnt( $result->output, $all_disks, "-e gives different output");
119like( $result->output, qr/$less_free/, "Found problem $less_free"); 132
120unlike( $result->only_output, qr/$more_free/, "Has ignored $more_free as not a problem"); 133# Need spaces around filesystem name in case less_free and more_free are nested
121like( $result->perf_output, qr/$more_free/, "But $more_free is still in perf data"); 134like( $result->output, qr/ $less_free /, "Found problem $less_free");
135unlike( $result->only_output, qr/ $more_free /, "Has ignored $more_free as not a problem");
136like( $result->perf_output, qr/ $more_free=/, "But $more_free is still in perf data");
122 137
123$result = NPTest->testCmd( 138$result = NPTest->testCmd(
124 "./check_disk -w $avg_free% -c 0% -p $more_free" 139 "./check_disk -w $avg_free% -c 0% -p $more_free"