summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
authorEthan Galstad <egalstad@users.sourceforge.net>2002-02-28 06:42:51 (GMT)
committerEthan Galstad <egalstad@users.sourceforge.net>2002-02-28 06:42:51 (GMT)
commit44a321cb8a42d6c0ea2d96a1086a17f2134c89cc (patch)
treea1a4d9f7b92412a17ab08f34f04eec45433048b7 /plugins/t
parent54fd5d7022ff2d6a59bc52b8869182f3fc77a058 (diff)
downloadmonitoring-plugins-44a321cb8a42d6c0ea2d96a1086a17f2134c89cc.tar.gz
Initial revision
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/t')
-rw-r--r--plugins/t/check_disk.t31
-rw-r--r--plugins/t/check_dns.t29
-rw-r--r--plugins/t/check_fping.t37
-rw-r--r--plugins/t/check_ftp.t32
-rw-r--r--plugins/t/check_hpjd.t32
-rw-r--r--plugins/t/check_http.t22
-rw-r--r--plugins/t/check_imap.t34
-rw-r--r--plugins/t/check_load.t27
-rw-r--r--plugins/t/check_mysql.t23
-rw-r--r--plugins/t/check_ping.t33
-rw-r--r--plugins/t/check_pop.t31
-rw-r--r--plugins/t/check_procs.t51
-rw-r--r--plugins/t/check_smtp.t31
-rw-r--r--plugins/t/check_snmp.t52
-rw-r--r--plugins/t/check_swap.t34
-rw-r--r--plugins/t/check_tcp.t27
-rw-r--r--plugins/t/check_time.t52
-rw-r--r--plugins/t/check_udp.t24
-rw-r--r--plugins/t/check_users.t28
-rw-r--r--plugins/t/check_vsz.t28
20 files changed, 658 insertions, 0 deletions
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t
new file mode 100644
index 0000000..f1e436d
--- /dev/null
+++ b/plugins/t/check_disk.t
@@ -0,0 +1,31 @@
1use strict;
2use Test;
3use vars qw($tests);
4
5BEGIN {$tests = 6; plan tests => $tests}
6
7my $null = '';
8my $cmd;
9my $str;
10my $t;
11
12$cmd = "./check_disk 100 100 /";
13$str = `$cmd`;
14$t += ok $?>>8,0;
15print "Test was: $cmd\n" if ($?);
16$t += ok $str, '/^(Disk ok - +[\.0-9]+|DISK OK - )/';
17
18$cmd = "./check_disk -w 0 -c 0 /";
19$str = `$cmd`;
20$t += ok $?>>8,0;
21print "Test was: $cmd\n" if ($?);
22$t += ok $str, '/^(Disk ok - +[\.0-9]+|DISK OK - )/';
23
24$cmd = "./check_disk 0 0 /";
25$str = `$cmd`;
26$t += ok $?>>8,2;
27print "Test was: $cmd\n" unless ($?);
28$t += ok $str, '/^(Only +[\.0-9]+|DISK CRITICAL - )/';
29
30exit(0) if defined($Test::Harness::VERSION);
31exit($tests - $t);
diff --git a/plugins/t/check_dns.t b/plugins/t/check_dns.t
new file mode 100644
index 0000000..a85e2e7
--- /dev/null
+++ b/plugins/t/check_dns.t
@@ -0,0 +1,29 @@
1#! /usr/bin/perl -w
2
3use strict;
4use Cache;
5use Test;
6use vars qw($tests);
7
8BEGIN {$tests = 3; plan tests => $tests}
9
10#`nslookup localhost > /dev/null 2>&1` || exit(77);
11
12my $null = '';
13my $cmd;
14my $str;
15my $t;
16
17$cmd = "./check_dns 127.0.0.1 -to 5";
18$str = `$cmd`;
19$t += ok $?>>8,0;
20print "Test was: $cmd\n" if ($?);
21$t += ok $str, '/DNS ok - +[\.0-9]+ seconds response time, Address\(es\) is\/are /';
22
23$cmd = "./check_dns $Cache::nullhost -to 1";
24$str = `$cmd`;
25$t += ok $?>>8,2;
26print "Test was: $cmd\n" unless ($?);
27
28exit(0) if defined($Test::Harness::VERSION);
29exit($tests - $t);
diff --git a/plugins/t/check_fping.t b/plugins/t/check_fping.t
new file mode 100644
index 0000000..629ee35
--- /dev/null
+++ b/plugins/t/check_fping.t
@@ -0,0 +1,37 @@
1#! /usr/bin/perl -w
2# $Id$
3
4use strict;
5use Cache;
6use Test;
7use vars qw($tests);
8
9BEGIN {$tests = 3; plan tests => $tests}
10
11exit(0) unless (-x "./check_fping");
12
13#`fping 127.0.0.1 > /dev/null 2>&1` || exit(77);
14
15my $null = '';
16my $cmd;
17my $str;
18my $t;
19my $stat;
20
21
22$cmd = "./check_fping 127.0.0.1";
23$str = `$cmd`;
24$t += ok $?>>8,0;
25print "Test was: $cmd\n" if ($?);
26$t += ok $str, '/^FPING OK - 127.0.0.1/';
27
28$cmd = "./check_fping $Cache::nullhost";
29$str = `$cmd`;
30if ($?>>8 == 1 or $?>>8 == 2) {
31 $stat = 2;
32}
33$t += ok $stat,2;
34print "Test was: $cmd\n" if (($?>>8) < 1);
35
36exit(0) if defined($Test::Harness::VERSION);
37exit($tests - $t);
diff --git a/plugins/t/check_ftp.t b/plugins/t/check_ftp.t
new file mode 100644
index 0000000..c3f74d9
--- /dev/null
+++ b/plugins/t/check_ftp.t
@@ -0,0 +1,32 @@
1#! /usr/bin/perl -w
2
3#use strict;
4use Cache;
5use Test;
6use vars qw($tests);
7
8BEGIN {$tests = 3; plan tests => $tests}
9
10my $null = '';
11my $cmd;
12my $str;
13my $t;
14
15$cmd = "./check_ftp $Cache::hostname -wt 300 -ct 600";
16$str = `$cmd`;
17$t += ok $?>>8,0;
18print "Test was: $cmd\n" if ($?);
19$t += ok $str, '/FTP ok - [0-9]+ second response time/';
20
21#$cmd = "./check_ftp $Cache::noserver -wt 0 -ct 0";
22#$str = `$cmd`;
23#$t += ok $?>>8,2;
24#print "Test was: $cmd\n" unless ($?);
25
26$cmd = "./check_ftp $Cache::nullhost -wt 0 -ct 0 -to 1";
27$str = `$cmd`;
28$t += ok $?>>8,2;
29print "Test was: $cmd\n" unless ($?);
30
31exit(0) if defined($Test::Harness::VERSION);
32exit($tests - $t);
diff --git a/plugins/t/check_hpjd.t b/plugins/t/check_hpjd.t
new file mode 100644
index 0000000..b4e198d
--- /dev/null
+++ b/plugins/t/check_hpjd.t
@@ -0,0 +1,32 @@
1#! /usr/bin/perl -w
2
3use strict;
4use Helper;
5use Cache;
6use Test;
7use vars qw($tests);
8
9BEGIN {$tests = 4; plan tests => $tests}
10
11exit(0) unless (-x "./check_hpjd");
12
13my $null = '';
14my $cmd;
15my $str;
16my $t;
17my $printer = get_option("hpjd_printer","HP Jet-Direct card address");
18
19$cmd = "./check_hpjd $printer";
20$str = `$cmd`;
21$t += ok $?>>8,0;
22print "Test was: $cmd\n" if ($?);
23$t += ok $str, '/^Printer ok - /';
24
25$cmd = "./check_hpjd $Cache::noserver";
26$str = `$cmd`;
27$t += ok $?>>8,2;
28print "Test was: $cmd\n" unless ($?);
29$t += ok $str, '/Timeout: No response from /';
30
31exit(0) if defined($Test::Harness::VERSION);
32exit($tests - $t);
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t
new file mode 100644
index 0000000..2782fcd
--- /dev/null
+++ b/plugins/t/check_http.t
@@ -0,0 +1,22 @@
1#! /usr/bin/perl -w
2
3use strict;
4use Cache;
5use Test;
6use vars qw($tests);
7
8BEGIN {$tests = 3; plan tests => $tests}
9
10my $null = '';
11my $str;
12my $t;
13
14$str = `./check_http $Cache::hostname -wt 300 -ct 600`;
15$t += ok $?>>8,0;
16$t += ok $str, '/HTTP\/1.1 [0-9]{3} (OK|Found) - [0-9]+ second response time/';
17
18$str = `./check_http $Cache::nullhost -wt 1 -ct 2`;
19$t += ok $?>>8,2;
20
21exit(0) if defined($Test::Harness::VERSION);
22exit($tests - $t);
diff --git a/plugins/t/check_imap.t b/plugins/t/check_imap.t
new file mode 100644
index 0000000..47494e5
--- /dev/null
+++ b/plugins/t/check_imap.t
@@ -0,0 +1,34 @@
1#! /usr/bin/perl -w
2
3#use strict;
4use Cache;
5use Test;
6use vars qw($tests);
7
8BEGIN {$tests = 3; plan tests => $tests}
9
10my $null = '';
11my $cmd;
12my $str;
13my $t;
14
15$cmd = "./check_imap $Cache::mailhost";
16$str = `$cmd`;
17$t += ok $?>>8,0;
18print "Test was: $cmd\n" if ($?);
19
20$cmd = "./check_imap -H $Cache::mailhost -p 143 -w 9 -c 9 -t 10 -e '* OK'";
21$str = `$cmd`;
22$t += ok $?>>8,0;
23print "Test was: $cmd\n" if ($?);
24
25
26# Reverse compatibility
27$cmd = "./check_imap $Cache::mailhost -p 143 -wt 9 -ct 9 -to 10 -e '* OK'";
28$str = `$cmd`;
29$t += ok $?>>8,0;
30print "Test was: $cmd\n" if ($?);
31
32exit(0) if defined($Test::Harness::VERSION);
33exit($tests - $t);
34
diff --git a/plugins/t/check_load.t b/plugins/t/check_load.t
new file mode 100644
index 0000000..ac14620
--- /dev/null
+++ b/plugins/t/check_load.t
@@ -0,0 +1,27 @@
1#! /usr/bin/perl -w
2
3use strict;
4use Test;
5use vars qw($tests);
6
7BEGIN {$tests = 4; plan tests => $tests}
8
9my $null = '';
10my $cmd;
11my $str;
12my $t;
13
14$cmd = "./check_load 100 100 100 100 100 100";
15$str = `$cmd`;
16$t += ok $?>>8,0;
17print "Test was: $cmd\n" if ($?);
18$t += ok $str, '/^load average: +[\.0-9]+, +[\.0-9]+, +[\.0-9]+$/';
19
20$cmd = "./check_load 0 0 0 0 0 0";
21$str = `$cmd`;
22$t += ok $?>>8,2;
23print "Test was: $cmd\n" unless ($?);
24$t += ok $str, '/^load average: +[\.0-9]+, +[\.0-9]+, +[\.0-9]+ CRITICAL$/';
25
26exit(0) if defined($Test::Harness::VERSION);
27exit($tests - $t);
diff --git a/plugins/t/check_mysql.t b/plugins/t/check_mysql.t
new file mode 100644
index 0000000..ae2a008
--- /dev/null
+++ b/plugins/t/check_mysql.t
@@ -0,0 +1,23 @@
1#! /usr/bin/perl -w
2
3use strict;
4use Cache;
5use Test;
6use vars qw($tests);
7
8BEGIN {$tests = 1; plan tests => $tests}
9
10exit(0) unless (-x "./check_mysql");
11
12my $null = '';
13my $cmd;
14my $str;
15my $t;
16
17$cmd = "./check_mysql -H 127.0.0.1 -P 3306";
18$str = `$cmd`;
19$t += ok $?>>8,0;
20print "Test was: $cmd\n" if ($?);
21
22exit(0) if defined($Test::Harness::VERSION);
23exit($tests - $t);
diff --git a/plugins/t/check_ping.t b/plugins/t/check_ping.t
new file mode 100644
index 0000000..97bc660
--- /dev/null
+++ b/plugins/t/check_ping.t
@@ -0,0 +1,33 @@
1#! /usr/bin/perl -w
2
3use strict;
4use Cache;
5use Test;
6use vars qw($tests);
7
8BEGIN {$tests = 5; plan tests => $tests}
9
10my $null = '';
11my $cmd;
12my $str;
13my $t;
14
15$cmd = "./check_ping 127.0.0.1 100 100 1000 1000 -p 1";
16$str = `$cmd`;
17$t += ok $?>>8,0;
18print "Test was: $cmd\n" if ($?);
19$t += ok $str, '/PING (ok|OK) - Packet loss = +[0-9]{1,2}\%, +RTA = [\.0-9]+ ms/';
20
21$cmd = "./check_ping 127.0.0.1 0 0 0 0 -p 1";
22$str = `$cmd`;
23$t += ok $?>>8,2;
24print "Test was: $cmd\n" unless ($?);
25$t += ok $str, '/Packet loss = +[0-9]{1,2}\%, +RTA = [\.0-9]+ ms/';
26
27$cmd = "./check_ping $Cache::nullhost 0 0 0 0 -p 1 -to 1";
28$str = `$cmd`;
29$t += ok $?>>8,2;
30print "Test was: $cmd\n" unless ($?);
31
32exit(0) if defined($Test::Harness::VERSION);
33exit($tests - $t);
diff --git a/plugins/t/check_pop.t b/plugins/t/check_pop.t
new file mode 100644
index 0000000..60b5a4e
--- /dev/null
+++ b/plugins/t/check_pop.t
@@ -0,0 +1,31 @@
1#! /usr/bin/perl -w
2
3#use strict;
4use Cache;
5use Test;
6use vars qw($tests);
7
8BEGIN {$tests = 3; plan tests => $tests}
9
10my $null = '';
11my $cmd;
12my $str;
13my $t;
14
15$cmd = "./check_pop $Cache::mailhost";
16$str = `$cmd`;
17$t += ok $?>>8,0;
18print "Test was: $cmd\n" if ($?);
19
20$cmd = "./check_pop -H $Cache::mailhost -p 110 -w 9 -c 9 -t 10 -e '+OK'";
21$str = `$cmd`;
22$t += ok $?>>8,0;
23print "Test was: $cmd\n" if ($?);
24
25$cmd = "./check_pop $Cache::mailhost -p 110 -wt 9 -ct 9 -to 10 -e '+OK'";
26$str = `$cmd`;
27$t += ok $?>>8,0;
28print "Test was: $cmd\n" if ($?);
29
30exit(0) if defined($Test::Harness::VERSION);
31exit($tests - $t);
diff --git a/plugins/t/check_procs.t b/plugins/t/check_procs.t
new file mode 100644
index 0000000..9c2330f
--- /dev/null
+++ b/plugins/t/check_procs.t
@@ -0,0 +1,51 @@
1#! /usr/bin/perl -w
2
3use strict;
4use Cache;
5use Test;
6use vars qw($tests);
7
8BEGIN {$tests = 10; plan tests => $tests}
9
10my $null = '';
11my $cmd;
12my $str;
13my $t;
14
15# Reverse Compatibility
16$cmd = "./check_procs 100000 100000";
17$str = `$cmd`;
18$t += ok $?>>8,0;
19print "Test was: $cmd\n" if ($?);
20$t += ok $str, '/^OK - [0-9]+ processes running$/';
21
22# Reverse Compatibility
23$cmd = "./check_procs 100000 100000 Z";
24$str = `$cmd`;
25$t += ok $?>>8,0;
26print "Test was: $cmd\n" if ($?);
27$t += ok $str, '/^OK - [0-9]+ processes running with /';
28
29# Reverse Compatibility
30$cmd = "./check_procs 0 10000000";
31$str = `$cmd`;
32$t += ok $?>>8,1;
33print "Test was: $cmd\n" unless ($?);
34$t += ok $str, '/^WARNING - [0-9]+ processes running$/';
35
36# Reverse Compatibility
37$cmd = "./check_procs 0 0";
38$str = `$cmd`;
39$t += ok $?>>8,2;
40print "Test was: $cmd\n" unless ($?);
41$t += ok $str, '/^CRITICAL - [0-9]+ processes running$/';
42
43# Reverse Compatibility
44$cmd = "./check_procs 0 0 S";
45$str = `$cmd`;
46$t += ok $?>>8,2;
47print "Test was: $cmd\n" unless ($?);
48$t += ok $str, '/^CRITICAL - [0-9]+ processes running with /';
49
50exit(0) if defined($Test::Harness::VERSION);
51exit($tests - $t);
diff --git a/plugins/t/check_smtp.t b/plugins/t/check_smtp.t
new file mode 100644
index 0000000..2a82b87
--- /dev/null
+++ b/plugins/t/check_smtp.t
@@ -0,0 +1,31 @@
1#! /usr/bin/perl -w
2
3#use strict;
4use Cache;
5use Test;
6use vars qw($tests);
7
8BEGIN {$tests = 3; plan tests => $tests}
9
10my $null = '';
11my $cmd;
12my $str;
13my $t;
14
15$cmd = "./check_smtp $Cache::mailhost";
16$str = `$cmd`;
17$t += ok $?>>8,0;
18print "Test was: $cmd\n" if ($?);
19
20$cmd = "./check_smtp -H $Cache::mailhost -p 25 -t 1 -w 9 -c 9 -t 10 -e 220";
21$str = `$cmd`;
22$t += ok $?>>8,0;
23print "Test was: $cmd\n" if ($?);
24
25$cmd = "./check_smtp -H $Cache::mailhost -p 25 -wt 9 -ct 9 -to 10 -e 220";
26$str = `$cmd`;
27$t += ok $?>>8,0;
28print "Test was: $cmd\n" if ($?);
29
30exit(0) if defined($Test::Harness::VERSION);
31exit($tests - $t);
diff --git a/plugins/t/check_snmp.t b/plugins/t/check_snmp.t
new file mode 100644
index 0000000..162b0b9
--- /dev/null
+++ b/plugins/t/check_snmp.t
@@ -0,0 +1,52 @@
1#! /usr/bin/perl -w
2
3use strict;
4use Helper;
5use Cache;
6use Test;
7use vars qw($tests);
8
9BEGIN {$tests = 8; plan tests => $tests}
10
11my $null = '';
12my $cmd;
13my $str;
14my $t;
15my $community=get_option("snmp_community","SNMP community name");
16
17exit(0) unless (-x "./check_snmp");
18
19$cmd = "./check_snmp -H 127.0.0.1 -C $community -o system.sysUpTime.0 -w 1: -c 1:";
20$str = `$cmd`;
21$t += ok $?>>8,0;
22print "Test was: $cmd\n" if ($?);
23chomp $str;
24$t += ok $str, '/^SNMP OK - \d+/';
25
26$cmd = "./check_snmp -H 127.0.0.1 -C $community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w 1:1 -c 1:1";
27$str = `$cmd`;
28$t += ok $?>>8,0;
29print "Test was: $cmd\n" if ($?);
30chomp $str;
31$t += ok $str, '/^SNMP OK - 1\s*$/';
32
33$cmd = "./check_snmp -H 127.0.0.1 -C $community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w 0 -c 1:";
34$str = `$cmd`;
35$t += ok $?>>8,1;
36print "Test was: $cmd\n" unless ($?);
37chomp $str;
38$t += ok $str, '/^SNMP WARNING - \*1\*\s*$/';
39
40$cmd = "./check_snmp -H 127.0.0.1 -C $community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w :0 -c 0";
41$str = `$cmd`;
42$t += ok $?>>8,2;
43print "Test was: $cmd\n" unless ($?);
44chomp $str;
45$t += ok $str, '/^SNMP CRITICAL - \*1\*\s*$/';
46
47#host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 = 1
48#enterprises.ucdavis.memory.memAvailSwap.0
49#./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)'
50
51exit(0) if defined($Test::Harness::VERSION);
52exit($tests - $t);
diff --git a/plugins/t/check_swap.t b/plugins/t/check_swap.t
new file mode 100644
index 0000000..5b702f0
--- /dev/null
+++ b/plugins/t/check_swap.t
@@ -0,0 +1,34 @@
1#! /usr/bin/perl -w
2
3use strict;
4use Cache;
5use Test;
6use vars qw($tests);
7
8BEGIN {$tests = 6; plan tests => $tests}
9
10my $null = '';
11my $cmd;
12my $str;
13my $t;
14
15$cmd = "./check_swap 100 100";
16$str = `$cmd`;
17$t += ok $?>>8,0;
18print "Test was: $cmd\n" if ($?);
19$t += ok $str, '/^Swap ok - Swap used\: +[0-9]{1,2}\% \([0-9]+ bytes out of [0-9]+\)$/';
20
21$cmd = "./check_swap 0 0";
22$str = `$cmd`;
23$t += ok $?>>8,2;
24print "Test was: $cmd\n" unless ($?);
25$t += ok $str, '/^CRITICAL - Swap used\: +[0-9]{1,2}\% \([0-9]+ bytes out of [0-9]+\)$/';
26
27$cmd = "./check_swap 100 100 1000000000 1000000000";
28$str = `$cmd`;
29$t += ok $?>>8,2;
30print "Test was: $cmd\n" unless ($?);
31$t += ok $str, '/^CRITICAL - Swap used\: +[0-9]{1,2}\% \([0-9]+ bytes out of [0-9]+\)$/';
32
33exit(0) if defined($Test::Harness::VERSION);
34exit($tests - $t);
diff --git a/plugins/t/check_tcp.t b/plugins/t/check_tcp.t
new file mode 100644
index 0000000..1abec76
--- /dev/null
+++ b/plugins/t/check_tcp.t
@@ -0,0 +1,27 @@
1#! /usr/bin/perl -w
2
3#use strict;
4use Cache;
5use Test;
6use vars qw($tests);
7
8BEGIN {$tests = 3; plan tests => $tests}
9
10my $null = '';
11my $cmd;
12my $str;
13my $t;
14
15$cmd = "./check_tcp $Cache::hostname -p 80 -wt 300 -ct 600";
16$str = `$cmd`;
17$t += ok $?>>8,0;
18print "$cmd\n" if ($?);
19$t += ok $str, '/^TCP OK - [0-9]+ second response time on port 80/';
20
21$cmd = "./check_tcp $Cache::nullhost -p 81 -wt 0 -ct 0 -to 1";
22$str = `$cmd`;
23$t += ok $?>>8,2;
24print "$cmd\n" unless ($?);
25
26exit(0) if defined($Test::Harness::VERSION);
27exit($tests - $t);
diff --git a/plugins/t/check_time.t b/plugins/t/check_time.t
new file mode 100644
index 0000000..4d8c5c2
--- /dev/null
+++ b/plugins/t/check_time.t
@@ -0,0 +1,52 @@
1#! /usr/bin/perl -w
2
3use strict;
4use Cache;
5use Helper;
6use Test;
7use vars qw($tests);
8
9BEGIN {$tests = 6; plan tests => $tests}
10
11my $null = '';
12my $cmd;
13my $str;
14my $t;
15my $udp_hostname=get_option("udp_hostname","UDP host name");
16
17# standard mode
18
19$cmd = "./check_time -H $udp_hostname -w 999999,59 -c 999999,59 -t 60";
20$str = `$cmd`;
21$t += ok $?>>8,0;
22print "Test was: $cmd\n" if ($?);
23$t += ok $str, '/^TIME OK - [0-9]+ second time difference$/';
24
25$cmd = "./check_time -H $udp_hostname -w 999999 -W 59 -c 999999 -C 59 -t 60";
26$str = `$cmd`;
27$t += ok $?>>8,0;
28print "Test was: $cmd\n" if ($?);
29$t += ok $str, '/^TIME OK - [0-9]+ second time difference$/';
30
31# reverse compatibility mode
32
33$cmd = "./check_time $udp_hostname -wt 59 -ct 59 -cd 999999 -wd 999999 -to 60";
34$str = `$cmd`;
35$t += ok $?>>8,0;
36print "Test was: $cmd\n" if ($?);
37$t += ok $str, '/^TIME OK - [0-9]+ second time difference$/';
38
39# failure mode
40
41#$cmd = "./check_time -H $Cache::nullhost -t 1";
42#$str = `$cmd`;
43#$t += ok $?>>8,255;
44#print "Test was: $cmd\n" unless ($?);
45
46#$cmd = "./check_time -H $Cache::noserver -t 1";
47#$str = `$cmd`;
48#$t += ok $?>>8,255;
49#print "$cmd\n" unless ($?);
50
51exit(0) if defined($Test::Harness::VERSION);
52exit($tests - $t);
diff --git a/plugins/t/check_udp.t b/plugins/t/check_udp.t
new file mode 100644
index 0000000..abbf5e4
--- /dev/null
+++ b/plugins/t/check_udp.t
@@ -0,0 +1,24 @@
1#! /usr/bin/perl -w
2
3#use strict;
4use Cache;
5use Helper;
6use Test;
7use vars qw($tests);
8
9BEGIN {$tests = 3; plan tests => $tests}
10
11my $null = '';
12my $str;
13my $t;
14my $hostname=get_option("udp_hostname","UDP host name");
15
16$str = `./check_udp $hostname -p 37 -wt 300 -ct 600`;
17$t += ok $?>>8,0;
18$t += ok $str, '/^Connection accepted on port 37 - [0-9]+ second response time$/';
19
20$str = `./check_udp $Cache::nullhost -p 80 -wt 0 -ct 0 -to 1`;
21$t += ok $?>>8,2;
22
23exit(0) if defined($Test::Harness::VERSION);
24exit($tests - $t);
diff --git a/plugins/t/check_users.t b/plugins/t/check_users.t
new file mode 100644
index 0000000..593f173
--- /dev/null
+++ b/plugins/t/check_users.t
@@ -0,0 +1,28 @@
1#! /usr/bin/perl -w
2
3use strict;
4use Cache;
5use Test;
6use vars qw($tests);
7
8BEGIN {$tests = 4; plan tests => $tests}
9
10my $null = '';
11my $cmd;
12my $str;
13my $t;
14
15$cmd = "./check_users 1000 1000";
16$str = `$cmd`;
17$t += ok $?>>8,0;
18print "Test was: $cmd\n" if ($?);
19$t += ok $str, '/^USERS OK - +[0-9]+ users currently logged in$/';
20
21$cmd = "./check_users 0 0";
22$str = `$cmd`;
23$t += ok $?>>8,2;
24print "Test was: $cmd\n" unless ($?);
25$t += ok $str, '/^USERS CRITICAL - [0-9]+ +users currently logged in$/';
26
27exit(0) if defined($Test::Harness::VERSION);
28exit($tests - $t);
diff --git a/plugins/t/check_vsz.t b/plugins/t/check_vsz.t
new file mode 100644
index 0000000..9597261
--- /dev/null
+++ b/plugins/t/check_vsz.t
@@ -0,0 +1,28 @@
1#! /usr/bin/perl -w
2
3use strict;
4use Cache;
5use Test;
6use vars qw($tests);
7
8BEGIN {$tests = 4; plan tests => $tests}
9
10my $null = '';
11my $cmd;
12my $str;
13my $t;
14
15$cmd = "./check_vsz 100000 1000000 init";
16$str = `$cmd`;
17$t += ok $?>>8,0;
18print "Test was: $cmd\n" if ($?);
19$t += ok $str, '/^ok \(all VSZ\<[0-9]+\)/';
20
21$cmd = "./check_vsz 0 0";
22$str = `$cmd`;
23$t += ok $?>>8,2;
24print "Test was: $cmd\n" unless ($?);
25$t += ok $str, '/^CRITICAL \(VSZ\>[0-9]+\)/';
26
27exit(0) if defined($Test::Harness::VERSION);
28exit($tests - $t);