mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-04-25 08:07:35 -04:00
Complete rewrite of the original testing infrastructure and all test cases (to use the new infrastructure) See NPTest.pm and issue 1185704 for more details. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1207 f882894a-f735-0410-b71e-b25c423dba1c
25 lines
690 B
Perl
25 lines
690 B
Perl
#! /usr/bin/perl -w -I ..
|
|
#
|
|
# Swap Space Tests via check_swap
|
|
#
|
|
# $Id$
|
|
#
|
|
|
|
use strict;
|
|
use Test;
|
|
use NPTest;
|
|
|
|
use vars qw($tests);
|
|
BEGIN {$tests = 6; plan tests => $tests}
|
|
|
|
my $t;
|
|
|
|
my $successOutput = '/^SWAP OK - [0-9]+\% free \([0-9]+ MB out of [0-9]+ MB\)/';
|
|
my $failureOutput = '/^SWAP CRITICAL - [0-9]+\% free \([0-9]+ MB out of [0-9]+ MB\)/';
|
|
|
|
$t += checkCmd( "./check_swap -w 1048576 -c 1048576", 0, $successOutput ); # 1MB free
|
|
$t += checkCmd( "./check_swap -w 1\% -c 1\%", 0, $successOutput ); # 1% free
|
|
$t += checkCmd( "./check_swap -w 100\% -c 100\%", 2, $failureOutput ); # 100% free (always fails)
|
|
|
|
exit(0) if defined($Test::Harness::VERSION);
|
|
exit($tests - $t);
|