remove source-dist branch
This commit is contained in:
commit
da7f7826b0
412 changed files with 127409 additions and 0 deletions
31
plugins/t/check_disk.t
Normal file
31
plugins/t/check_disk.t
Normal file
|
@ -0,0 +1,31 @@
|
|||
use strict;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 6; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
$cmd = "./check_disk 100 100 /";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/^(Disk ok - +[\.0-9]+|DISK OK - )/';
|
||||
|
||||
$cmd = "./check_disk -w 0 -c 0 /";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/^(Disk ok - +[\.0-9]+|DISK OK - )/';
|
||||
|
||||
$cmd = "./check_disk 0 0 /";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
$t += ok $str, '/^(Only +[\.0-9]+|DISK CRITICAL - )/';
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
28
plugins/t/check_dns.t
Normal file
28
plugins/t/check_dns.t
Normal file
|
@ -0,0 +1,28 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 3; plan tests => $tests}
|
||||
|
||||
#`nslookup localhost > /dev/null 2>&1` || exit(77);
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
$str = `./check_dns $Cache::dnshost -to 5`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/DNS OK: +[\.0-9]+ seconds response time, /';
|
||||
|
||||
$cmd = "./check_dns $Cache::nullhost -to 1";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
37
plugins/t/check_fping.t
Normal file
37
plugins/t/check_fping.t
Normal file
|
@ -0,0 +1,37 @@
|
|||
#! /usr/bin/perl -w
|
||||
# $Id: check_fping.t,v 1.1.1.1 2002/02/28 06:43:00 egalstad Exp $
|
||||
|
||||
use strict;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 3; plan tests => $tests}
|
||||
|
||||
exit(0) unless (-x "./check_fping");
|
||||
|
||||
#`fping 127.0.0.1 > /dev/null 2>&1` || exit(77);
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
my $stat;
|
||||
|
||||
|
||||
$cmd = "./check_fping 127.0.0.1";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/^FPING OK - 127.0.0.1/';
|
||||
|
||||
$cmd = "./check_fping $Cache::nullhost";
|
||||
$str = `$cmd`;
|
||||
if ($?>>8 == 1 or $?>>8 == 2) {
|
||||
$stat = 2;
|
||||
}
|
||||
$t += ok $stat,2;
|
||||
print "Test was: $cmd\n" if (($?>>8) < 1);
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
32
plugins/t/check_ftp.t
Normal file
32
plugins/t/check_ftp.t
Normal file
|
@ -0,0 +1,32 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
#use strict;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 3; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
$cmd = "./check_ftp $Cache::hostname -wt 300 -ct 600";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/FTP OK -\s+[0-9]?\.?[0-9]+ second response time/';
|
||||
|
||||
#$cmd = "./check_ftp $Cache::noserver -wt 0 -ct 0";
|
||||
#$str = `$cmd`;
|
||||
#$t += ok $?>>8,2;
|
||||
#print "Test was: $cmd\n" unless ($?);
|
||||
|
||||
$cmd = "./check_ftp $Cache::nullhost -wt 0 -ct 0 -to 1";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
32
plugins/t/check_hpjd.t
Normal file
32
plugins/t/check_hpjd.t
Normal file
|
@ -0,0 +1,32 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use Helper;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 4; plan tests => $tests}
|
||||
|
||||
exit(0) unless (-x "./check_hpjd");
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
my $printer = get_option("hpjd_printer","HP Jet-Direct card address");
|
||||
|
||||
$cmd = "./check_hpjd $printer";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/^Printer ok - /';
|
||||
|
||||
$cmd = "./check_hpjd $Cache::noserver";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
$t += ok $str, '/Timeout: No response from /';
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
22
plugins/t/check_http.t
Normal file
22
plugins/t/check_http.t
Normal file
|
@ -0,0 +1,22 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 3; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
$str = `./check_http $Cache::httphost -wt 300 -ct 600`;
|
||||
$t += ok $?>>8,0;
|
||||
$t += ok $str, '/(HTTP\s[o|O][k|K]\s)?\s?HTTP\/1.[01]\s[0-9]{3}\s(OK|Found)\s-\s+[0-9]+\sbytes\sin\s+([0-9]+|[0-9]+\.[0-9]+)\sseconds/';
|
||||
|
||||
$str = `./check_http $Cache::nullhost -wt 1 -ct 2`;
|
||||
$t += ok $?>>8,2;
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
34
plugins/t/check_imap.t
Normal file
34
plugins/t/check_imap.t
Normal file
|
@ -0,0 +1,34 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
#use strict;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 3; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
$cmd = "./check_imap $Cache::mailhost";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
|
||||
$cmd = "./check_imap -H $Cache::mailhost -p 143 -w 9 -c 9 -t 10 -e '* OK'";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
|
||||
|
||||
# Reverse compatibility
|
||||
$cmd = "./check_imap $Cache::mailhost -p 143 -wt 9 -ct 9 -to 10 -e '* OK'";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
||||
|
27
plugins/t/check_load.t
Normal file
27
plugins/t/check_load.t
Normal file
|
@ -0,0 +1,27 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 4; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
$cmd = "./check_load -w 100,100,100 -c 100,100,100";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/^OK - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/';
|
||||
|
||||
$cmd = "./check_load -w 0,0,0 -c 0,0,0";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
$t += ok $str, '/^CRITICAL - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/';
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
26
plugins/t/check_mysql.t
Normal file
26
plugins/t/check_mysql.t
Normal file
|
@ -0,0 +1,26 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use Helper;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 2; plan tests => $tests}
|
||||
|
||||
exit(0) unless (-x "./check_mysql");
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
my $mysqlserver = get_option("mysqlserver","host for MYSQL tests");
|
||||
|
||||
$cmd = "./check_mysql -H $mysqlserver -P 3306";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
$t += ok $str, '/Access denied for user: /';
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
33
plugins/t/check_ping.t
Normal file
33
plugins/t/check_ping.t
Normal file
|
@ -0,0 +1,33 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 5; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
$cmd = "./check_ping 127.0.0.1 100 100 1000 1000 -p 1";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/PING (ok|OK) - Packet loss = +[0-9]{1,2}\%, +RTA = [\.0-9]+ ms/';
|
||||
|
||||
$cmd = "./check_ping 127.0.0.1 0 0 0 0 -p 1";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
$t += ok $str, '/Packet loss = +[0-9]{1,2}\%, +RTA = [\.0-9]+ ms/';
|
||||
|
||||
$cmd = "./check_ping $Cache::nullhost 0 0 0 0 -p 1 -to 1";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
31
plugins/t/check_pop.t
Normal file
31
plugins/t/check_pop.t
Normal file
|
@ -0,0 +1,31 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
#use strict;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 3; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
$cmd = "./check_pop $Cache::mailhost";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
|
||||
$cmd = "./check_pop -H $Cache::mailhost -p 110 -w 9 -c 9 -t 10 -e '+OK'";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
|
||||
$cmd = "./check_pop $Cache::mailhost -p 110 -wt 9 -ct 9 -to 10 -e '+OK'";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
51
plugins/t/check_procs.t
Normal file
51
plugins/t/check_procs.t
Normal file
|
@ -0,0 +1,51 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 10; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
# Reverse Compatibility
|
||||
$cmd = "./check_procs -w 100000 -c 100000";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/^PROCS OK: [0-9]+ process(es)?$/';
|
||||
|
||||
# Reverse Compatibility
|
||||
$cmd = "./check_procs -w 100000 -c 100000 -s Z";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/^PROCS OK: [0-9]+ process(es)? with /';
|
||||
|
||||
# Reverse Compatibility
|
||||
$cmd = "./check_procs -w 0 -c 10000000";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,1;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
$t += ok $str, '/^PROCS WARNING: [0-9]+ process(es)?$/';
|
||||
|
||||
# Reverse Compatibility
|
||||
$cmd = "./check_procs -w 0 -c 0";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
$t += ok $str, '/^PROCS CRITICAL: [0-9]+ process(es)?$/';
|
||||
|
||||
# Reverse Compatibility
|
||||
$cmd = "./check_procs -w 0 -c 0 -s S";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
$t += ok $str, '/^PROCS CRITICAL: [0-9]+ process(es)? with /';
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
31
plugins/t/check_smtp.t
Normal file
31
plugins/t/check_smtp.t
Normal file
|
@ -0,0 +1,31 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
#use strict;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 3; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
$cmd = "./check_smtp $Cache::mailhost";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
|
||||
$cmd = "./check_smtp -H $Cache::mailhost -p 25 -t 1 -w 9 -c 9 -t 10 -e 220";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
|
||||
$cmd = "./check_smtp -H $Cache::mailhost -p 25 -wt 9 -ct 9 -to 10 -e 220";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
52
plugins/t/check_snmp.t
Normal file
52
plugins/t/check_snmp.t
Normal file
|
@ -0,0 +1,52 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use Helper;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 8; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
my $community=get_option("snmp_community","SNMP community name");
|
||||
|
||||
exit(0) unless (-x "./check_snmp");
|
||||
|
||||
$cmd = "./check_snmp -H 127.0.0.1 -C $community -o system.sysUpTime.0 -w 1: -c 1:";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
chomp $str;
|
||||
$t += ok $str, '/^SNMP OK - \d+/';
|
||||
|
||||
$cmd = "./check_snmp -H 127.0.0.1 -C $community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w 1:1 -c 1:1";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
chomp $str;
|
||||
$t += ok $str, '/^SNMP OK - 1\s*$/';
|
||||
|
||||
$cmd = "./check_snmp -H 127.0.0.1 -C $community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w 0 -c 1:";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,1;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
chomp $str;
|
||||
$t += ok $str, '/^SNMP WARNING - \*1\*\s*$/';
|
||||
|
||||
$cmd = "./check_snmp -H 127.0.0.1 -C $community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w :0 -c 0";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
chomp $str;
|
||||
$t += ok $str, '/^SNMP CRITICAL - \*1\*\s*$/';
|
||||
|
||||
#host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 = 1
|
||||
#enterprises.ucdavis.memory.memAvailSwap.0
|
||||
#./check_snmp 127.0.0.1 -C staff -o enterprises.ucdavis.diskTable.dskEntry.dskAvail.1,enterprises.ucdavis.diskTable.dskEntry.dskPercent.1 -w 100000: -c 50000: -l Space on root -u 'bytes free (','% used)'
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
34
plugins/t/check_swap.t
Normal file
34
plugins/t/check_swap.t
Normal file
|
@ -0,0 +1,34 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 6; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
$cmd = "./check_swap 100 100";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/^Swap ok - Swap used\: +[0-9]{1,2}\% \([0-9]+ bytes out of [0-9]+\)$/';
|
||||
|
||||
$cmd = "./check_swap 0 0";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
$t += ok $str, '/^CRITICAL - Swap used\: +[0-9]{1,2}\% \([0-9]+ bytes out of [0-9]+\)$/';
|
||||
|
||||
$cmd = "./check_swap 100 100 1000000000 1000000000";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
$t += ok $str, '/^CRITICAL - Swap used\: +[0-9]{1,2}\% \([0-9]+ bytes out of [0-9]+\)$/';
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
27
plugins/t/check_tcp.t
Normal file
27
plugins/t/check_tcp.t
Normal file
|
@ -0,0 +1,27 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
#use strict;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 3; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
$cmd = "./check_tcp $Cache::hostname -p 80 -wt 300 -ct 600";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "$cmd\n" if ($?);
|
||||
$t += ok $str, '/^TCP OK\s-\s+[0-9]?\.?[0-9]+ second response time on port 80/';
|
||||
|
||||
$cmd = "./check_tcp $Cache::nullhost -p 81 -wt 0 -ct 0 -to 1";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "$cmd\n" unless ($?);
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
52
plugins/t/check_time.t
Normal file
52
plugins/t/check_time.t
Normal file
|
@ -0,0 +1,52 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use Cache;
|
||||
use Helper;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 6; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
my $udp_hostname=get_option("udp_hostname","UDP host name");
|
||||
|
||||
# standard mode
|
||||
|
||||
$cmd = "./check_time -H $udp_hostname -w 999999,59 -c 999999,59 -t 60";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/^TIME OK - [0-9]+ second time difference$/';
|
||||
|
||||
$cmd = "./check_time -H $udp_hostname -w 999999 -W 59 -c 999999 -C 59 -t 60";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/^TIME OK - [0-9]+ second time difference$/';
|
||||
|
||||
# reverse compatibility mode
|
||||
|
||||
$cmd = "./check_time $udp_hostname -wt 59 -ct 59 -cd 999999 -wd 999999 -to 60";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/^TIME OK - [0-9]+ second time difference$/';
|
||||
|
||||
# failure mode
|
||||
|
||||
#$cmd = "./check_time -H $Cache::nullhost -t 1";
|
||||
#$str = `$cmd`;
|
||||
#$t += ok $?>>8,255;
|
||||
#print "Test was: $cmd\n" unless ($?);
|
||||
|
||||
#$cmd = "./check_time -H $Cache::noserver -t 1";
|
||||
#$str = `$cmd`;
|
||||
#$t += ok $?>>8,255;
|
||||
#print "$cmd\n" unless ($?);
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
24
plugins/t/check_udp.t
Normal file
24
plugins/t/check_udp.t
Normal file
|
@ -0,0 +1,24 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
#use strict;
|
||||
use Cache;
|
||||
use Helper;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 3; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $str;
|
||||
my $t;
|
||||
my $hostname=get_option("udp_hostname","UDP host name");
|
||||
|
||||
$str = `./check_udp $hostname -p 37 -wt 300 -ct 600`;
|
||||
$t += ok $?>>8,0;
|
||||
$t += ok $str, '/^Connection accepted on port 37 - [0-9]+ second response time$/';
|
||||
|
||||
$str = `./check_udp $Cache::nullhost -p 80 -wt 0 -ct 0 -to 1`;
|
||||
$t += ok $?>>8,2;
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
28
plugins/t/check_users.t
Normal file
28
plugins/t/check_users.t
Normal file
|
@ -0,0 +1,28 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 4; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
$cmd = "./check_users 1000 1000";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/^USERS OK - +[0-9]+ users currently logged in$/';
|
||||
|
||||
$cmd = "./check_users 0 0";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
$t += ok $str, '/^USERS CRITICAL - [0-9]+ +users currently logged in$/';
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
28
plugins/t/check_vsz.t
Normal file
28
plugins/t/check_vsz.t
Normal file
|
@ -0,0 +1,28 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use Cache;
|
||||
use Test;
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 4; plan tests => $tests}
|
||||
|
||||
my $null = '';
|
||||
my $cmd;
|
||||
my $str;
|
||||
my $t;
|
||||
|
||||
$cmd = "./check_vsz 100000 1000000 init";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,0;
|
||||
print "Test was: $cmd\n" if ($?);
|
||||
$t += ok $str, '/^ok \(all VSZ\<[0-9]+\)/';
|
||||
|
||||
$cmd = "./check_vsz 0 0";
|
||||
$str = `$cmd`;
|
||||
$t += ok $?>>8,2;
|
||||
print "Test was: $cmd\n" unless ($?);
|
||||
$t += ok $str, '/^CRITICAL \(VSZ\>[0-9]+\)/';
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
Loading…
Add table
Add a link
Reference in a new issue