summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2006-07-13 23:58:00 +0000
committerTon Voon <tonvoon@users.sourceforge.net>2006-07-13 23:58:00 +0000
commit5912398b9723545ecd061650667cbb238be85743 (patch)
treee5d8353cc8d8c278bfc22bd926f613da63f5e83f /plugins/t
parent548083b2ea865474915fc8a9ddd361e997585a02 (diff)
downloadmonitoring-plugins-5912398b9723545ecd061650667cbb238be85743.tar.gz
Major fixes to check_disk. Now should return same data as df
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1452 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/t')
-rw-r--r--plugins/t/check_disk.t51
1 files changed, 22 insertions, 29 deletions
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t
index 70d8415c..66344927 100644
--- a/plugins/t/check_disk.t
+++ b/plugins/t/check_disk.t
@@ -52,8 +52,8 @@ if ($free_on_mp1 > $free_on_mp2) {
52} 52}
53 53
54 54
55$result = NPTest->testCmd( "./check_disk -w 100 -c 100 -p $more_free" ); 55$result = NPTest->testCmd( "./check_disk -w 1 -c 1 -p $more_free" );
56cmp_ok( $result->return_code, '==', 0, "At least 100 bytes available on $more_free"); 56cmp_ok( $result->return_code, '==', 0, "At least 1 MB available on $more_free");
57like ( $result->output, $successOutput, "OK output" ); 57like ( $result->output, $successOutput, "OK output" );
58 58
59$result = NPTest->testCmd( "./check_disk 100 100 $more_free" ); 59$result = NPTest->testCmd( "./check_disk 100 100 $more_free" );
@@ -110,35 +110,28 @@ cmp_ok( $result->return_code, '==', 2, "And reversing arguments should not make
110 110
111 111
112 112
113
114$result = NPTest->testCmd(
115 "./check_disk -w 10% -c 15% -p $mountpoint_valid"
116 );
117cmp_ok( $result->return_code, '==', 3, "Invalid command line options" );
118
119TODO: { 113TODO: {
120 local $TODO = "-p must come after -w and -c"; 114 local $TODO = "Invalid percent figures";
121 $result = NPTest->testCmd( 115 $result = NPTest->testCmd(
116 "./check_disk -w 10% -c 15% -p $mountpoint_valid"
117 );
118 cmp_ok( $result->return_code, '==', 3, "Invalid command line options" );
119}
120
121$result = NPTest->testCmd(
122 "./check_disk -p $mountpoint_valid -w 10% -c 15%" 122 "./check_disk -p $mountpoint_valid -w 10% -c 15%"
123 ); 123 );
124 cmp_ok( $result->return_code, "==", 3, "Invalid options - order unimportant" ); 124cmp_ok( $result->return_code, "==", 3, "Invalid options: -p must come after thresholds" );
125}
126 125
127$result = NPTest->testCmd( "./check_disk -w 100% -c 100% ".${mountpoint_valid} ); # 100% empty 126$result = NPTest->testCmd( "./check_disk -w 100% -c 100% ".${mountpoint_valid} ); # 100% empty
128cmp_ok( $result->return_code, "==", 2, "100% empty" ); 127cmp_ok( $result->return_code, "==", 2, "100% empty" );
129like( $result->output, $failureOutput, "Right output" ); 128like( $result->output, $failureOutput, "Right output" );
130 129
131TODO: { 130$result = NPTest->testCmd( "./check_disk -w 100000 -c 100000 $mountpoint_valid" );
132 local $TODO = "Requesting 100GB free is should be critical"; 131cmp_ok( $result->return_code, '==', 2, "Check for 100GB free" );
133 $result = NPTest->testCmd( "./check_disk -w 100000 -c 100000 $mountpoint_valid" );
134 cmp_ok( $result->return_code, '==', 2, "Check for 100GB free" );
135}
136 132
137TODO: { 133$result = NPTest->testCmd( "./check_disk -w 100 -c 100 -u GB ".${mountpoint_valid} ); # 100 GB empty
138 local $TODO = "-u GB does not work"; 134cmp_ok( $result->return_code, "==", 2, "100 GB empty" );
139 $result = NPTest->testCmd( "./check_disk -w 100 -c 100 -u GB ".${mountpoint_valid} ); # 100 GB empty
140 cmp_ok( $result->return_code, "==", 2, "100 GB empty" );
141}
142 135
143 136
144# Checking old syntax of check_disk warn crit [fs], with warn/crit at USED% thresholds 137# Checking old syntax of check_disk warn crit [fs], with warn/crit at USED% thresholds
@@ -151,17 +144,17 @@ cmp_ok( $result->return_code, '==', 0, "Old syntax: 100% used" );
151$result = NPTest->testCmd( "./check_disk 0 100 $mountpoint_valid" ); 144$result = NPTest->testCmd( "./check_disk 0 100 $mountpoint_valid" );
152cmp_ok( $result->return_code, '==', 1, "Old syntax: warn 0% used" ); 145cmp_ok( $result->return_code, '==', 1, "Old syntax: warn 0% used" );
153 146
154$result = NPTest->testCmd( "./check_disk 0 200 $mountpoint_valid" );
155cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" );
156
157TODO: { 147TODO: {
158 local $TODO = "Need to properly check input"; 148 local $TODO = "Invalid values";
149 $result = NPTest->testCmd( "./check_disk 0 200 $mountpoint_valid" );
150 cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" );
151
159 $result = NPTest->testCmd( "./check_disk 200 200 $mountpoint_valid" ); 152 $result = NPTest->testCmd( "./check_disk 200 200 $mountpoint_valid" );
160 cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); 153 cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" );
161}
162 154
163$result = NPTest->testCmd( "./check_disk 200 0 $mountpoint_valid" ); 155 $result = NPTest->testCmd( "./check_disk 200 0 $mountpoint_valid" );
164cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); 156 cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" );
157}
165 158
166$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p /bob" ); 159$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p /bob" );
167cmp_ok( $result->return_code, '==', 2, "Checking /bob - return error because /bob does not exist" ); 160cmp_ok( $result->return_code, '==', 2, "Checking /bob - return error because /bob does not exist" );