diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_disk.c | 4 | ||||
-rw-r--r-- | plugins/t/check_disk.t | 18 |
2 files changed, 18 insertions, 4 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 0ee6dc87..fa913ac7 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -275,8 +275,6 @@ main (int argc, char **argv) | |||
275 | 275 | ||
276 | } | 276 | } |
277 | 277 | ||
278 | asprintf (&output, "%s|%s", output, perf); | ||
279 | |||
280 | if (verbose > 2) | 278 | if (verbose > 2) |
281 | asprintf (&output, "%s%s", output, details); | 279 | asprintf (&output, "%s%s", output, details); |
282 | 280 | ||
@@ -290,7 +288,7 @@ main (int argc, char **argv) | |||
290 | temp_list = temp_list->name_next; | 288 | temp_list = temp_list->name_next; |
291 | } | 289 | } |
292 | 290 | ||
293 | printf ("DISK %s%s\n", state_text (result), output); | 291 | printf ("DISK %s%s|%s\n", state_text (result), output, perf); |
294 | return result; | 292 | return result; |
295 | } | 293 | } |
296 | 294 | ||
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index 385865fe..90ccc26a 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t | |||
@@ -22,7 +22,7 @@ my $mountpoint2_valid = getTestParameter( "NP_MOUNTPOINT2_VALID", "Path to anoth | |||
22 | if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { | 22 | if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { |
23 | plan skip_all => "Need 2 mountpoints to test"; | 23 | plan skip_all => "Need 2 mountpoints to test"; |
24 | } else { | 24 | } else { |
25 | plan tests => 26; | 25 | plan tests => 31; |
26 | } | 26 | } |
27 | 27 | ||
28 | $result = NPTest->testCmd( | 28 | $result = NPTest->testCmd( |
@@ -157,3 +157,19 @@ TODO: { | |||
157 | $result = NPTest->testCmd( "./check_disk 200 0 $mountpoint_valid" ); | 157 | $result = NPTest->testCmd( "./check_disk 200 0 $mountpoint_valid" ); |
158 | cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); | 158 | cmp_ok( $result->return_code, '==', 3, "Old syntax: Error with values outside percent range" ); |
159 | 159 | ||
160 | TODO: { | ||
161 | local $TODO = "Check existence of each filesystem as a directory"; | ||
162 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p /bob" ); | ||
163 | cmp_ok( $result->return_code, '==', 2, "Checking /bob - return error because /bob does not exist" ); | ||
164 | } | ||
165 | |||
166 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p /" ); | ||
167 | my $root_output = $result->output; | ||
168 | |||
169 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p /etc" ); | ||
170 | cmp_ok( $result->return_code, '==', 0, "Checking /etc - should return info for /" ); | ||
171 | cmp_ok( $result->output, 'eq', $root_output, "check_disk /etc gives same as check_disk /"); | ||
172 | |||
173 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p / -p /bob" ); | ||
174 | cmp_ok( $result->return_code, '==', 2, "Checking / and /bob gives critical"); | ||
175 | unlike( $result->perf_output, 'm#/bob#', "perf data does not have /bob in it"); | ||