summaryrefslogtreecommitdiffstats
path: root/plugins/t/check_disk.t
blob: df6e14956c2a718bb232aa10d485adae63759dc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#! /usr/bin/perl -w -I ..
#
# Disk Space Tests via check_disk
#
# $Id$
#

use strict;
use Test;
use NPTest;

use vars qw($tests);
BEGIN {$tests = 8; plan tests => $tests}

my $successOutput = '/^DISK OK - /';
my $failureOutput = '/^DISK CRITICAL - /';

my $mountpoint_valid   = getTestParameter( "mountpoint_valid",   "NP_MOUNTPOINT_VALID",   "/",
					   "The path to a valid mountpoint" );

my $t;

$t += checkCmd( "./check_disk 100 100       ${mountpoint_valid}",   0, $successOutput );
$t += checkCmd( "./check_disk -w 0 -c 0     ${mountpoint_valid}",   0, $successOutput );
$t += checkCmd( "./check_disk -w 1\% -c 1\% ${mountpoint_valid}",   0, $successOutput );
$t += checkCmd( "./check_disk 0 0           ${mountpoint_valid}",   2, $failureOutput );

exit(0) if defined($Test::Harness::VERSION);
exit($tests - $t);