diff options
Diffstat (limited to 'plugins/t')
-rw-r--r-- | plugins/t/check_apt.t | 90 | ||||
-rw-r--r-- | plugins/t/check_apt_input/debian1 | 4 | ||||
-rw-r--r-- | plugins/t/check_apt_input/debian2 | 37 | ||||
-rw-r--r-- | plugins/t/check_apt_input/debian3 | 42 | ||||
-rw-r--r-- | plugins/t/check_apt_input/ubuntu1 | 14 | ||||
-rw-r--r-- | plugins/t/check_apt_input/ubuntu2 | 54 | ||||
-rw-r--r-- | plugins/t/check_dig.t | 22 | ||||
-rw-r--r-- | plugins/t/check_http.t | 32 | ||||
-rw-r--r-- | plugins/t/check_procs.t | 6 | ||||
-rw-r--r-- | plugins/t/check_tcp.t | 4 |
10 files changed, 279 insertions, 26 deletions
diff --git a/plugins/t/check_apt.t b/plugins/t/check_apt.t new file mode 100644 index 0000000..9ba0ff8 --- /dev/null +++ b/plugins/t/check_apt.t | |||
@@ -0,0 +1,90 @@ | |||
1 | #!/usr/bin/perl -w -I .. | ||
2 | # | ||
3 | # Test check_apt using input files. | ||
4 | # Contributed by Alex Bradley, October 2012 | ||
5 | # | ||
6 | |||
7 | use strict; | ||
8 | use Test::More; | ||
9 | use NPTest; | ||
10 | |||
11 | sub make_result_regexp { | ||
12 | my ($warning, $critical) = @_; | ||
13 | my $status; | ||
14 | if ($warning == 0 && $critical == 0) { | ||
15 | $status = "OK"; | ||
16 | } elsif ($critical == 0) { | ||
17 | $status = "WARNING"; | ||
18 | } else { | ||
19 | $status = "CRITICAL"; | ||
20 | } | ||
21 | return sprintf('/^APT %s: %d packages available for upgrade \(%d critical updates\)\. |available_upgrades=%d;;;0 critical_updates=%d;;;0$/', | ||
22 | $status, $warning, $critical, $warning, $critical); | ||
23 | } | ||
24 | |||
25 | if (-x "./check_apt") { | ||
26 | plan tests => 28; | ||
27 | } else { | ||
28 | plan skip_all => "No check_apt compiled"; | ||
29 | } | ||
30 | |||
31 | my $result; | ||
32 | |||
33 | my $testfile_command = "./check_apt %s --input-file=t/check_apt_input/%s"; | ||
34 | |||
35 | $result = NPTest->testCmd( sprintf($testfile_command, "", "debian1") ); | ||
36 | is( $result->return_code, 0, "No upgrades" ); | ||
37 | like( $result->output, make_result_regexp(0, 0), "Output correct" ); | ||
38 | |||
39 | $result = NPTest->testCmd( sprintf($testfile_command, "", "debian2") ); | ||
40 | is( $result->return_code, 1, "Debian apt output, warning" ); | ||
41 | like( $result->output, make_result_regexp(13, 0), "Output correct" ); | ||
42 | |||
43 | $result = NPTest->testCmd( sprintf($testfile_command, "", "debian3") ); | ||
44 | is( $result->return_code, 2, "Debian apt output, some critical" ); | ||
45 | like( $result->output, make_result_regexp(19, 4), "Output correct" ); | ||
46 | |||
47 | $result = NPTest->testCmd( sprintf($testfile_command, "-c '^[^\\(]*\\(.* (Debian-Security:|Ubuntu:[^/]*/[^-]*-security)'", "debian3") ); | ||
48 | is( $result->return_code, 2, "Debian apt output - should have same result when default security regexp specified via -c" ); | ||
49 | like( $result->output, make_result_regexp(19, 4), "Output correct" ); | ||
50 | |||
51 | $result = NPTest->testCmd( sprintf($testfile_command, "-i libc6", "debian3") ); | ||
52 | is( $result->return_code, 1, "Debian apt output, filter for libc6" ); | ||
53 | like( $result->output, make_result_regexp(3, 0), "Output correct" ); | ||
54 | |||
55 | $result = NPTest->testCmd( sprintf($testfile_command, "-i libc6 -i xen", "debian3") ); | ||
56 | is( $result->return_code, 2, "Debian apt output, filter for libc6 and xen" ); | ||
57 | like( $result->output, make_result_regexp(9, 4), "Output correct" ); | ||
58 | |||
59 | $result = NPTest->testCmd( sprintf($testfile_command, "-i libc6 -i xen -i linux", "debian3") ); | ||
60 | is( $result->return_code, 2, "Debian apt output, filter for libc6, xen, linux" ); | ||
61 | like( $result->output, make_result_regexp(12, 4), "Output correct" ); | ||
62 | |||
63 | $result = NPTest->testCmd( sprintf($testfile_command, "-e libc6", "debian3") ); | ||
64 | is( $result->return_code, 2, "Debian apt output, filter out libc6" ); | ||
65 | like( $result->output, make_result_regexp(16, 4), "Output correct" ); | ||
66 | |||
67 | $result = NPTest->testCmd( sprintf($testfile_command, "-e libc6 -e xen", "debian3") ); | ||
68 | is( $result->return_code, 1, "Debian apt output, filter out libc6 and xen" ); | ||
69 | like( $result->output, make_result_regexp(10, 0), "Output correct" ); | ||
70 | |||
71 | $result = NPTest->testCmd( sprintf($testfile_command, "-e libc6 -e xen -e linux", "debian3") ); | ||
72 | is( $result->return_code, 1, "Debian apt output, filter out libc6, xen, linux" ); | ||
73 | like( $result->output, make_result_regexp(7, 0), "Output correct" ); | ||
74 | |||
75 | $result = NPTest->testCmd( sprintf($testfile_command, "-c Debian-Security -c linux", "debian3") ); | ||
76 | is( $result->return_code, 2, "Debian apt output, critical on Debian-Security or linux" ); | ||
77 | like( $result->output, make_result_regexp(19, 9), "Output correct" ); | ||
78 | |||
79 | $result = NPTest->testCmd( sprintf($testfile_command, "-i lib -i linux -e gc1c -c linux-image", "debian3") ); | ||
80 | is( $result->return_code, 2, "Debian apt output, include lib and linux, exclude gc1c, critical on linux-image" ); | ||
81 | like( $result->output, make_result_regexp(10, 2), "Output correct" ); | ||
82 | |||
83 | $result = NPTest->testCmd( sprintf($testfile_command, "", "ubuntu1") ); | ||
84 | is( $result->return_code, 1, "Ubuntu apt output, warning" ); | ||
85 | like( $result->output, make_result_regexp(5, 0), "Output correct" ); | ||
86 | |||
87 | $result = NPTest->testCmd( sprintf($testfile_command, "", "ubuntu2") ); | ||
88 | is( $result->return_code, 2, "Ubuntu apt output, some critical" ); | ||
89 | like( $result->output, make_result_regexp(25, 14), "Output correct" ); | ||
90 | |||
diff --git a/plugins/t/check_apt_input/debian1 b/plugins/t/check_apt_input/debian1 new file mode 100644 index 0000000..317e7ea --- /dev/null +++ b/plugins/t/check_apt_input/debian1 | |||
@@ -0,0 +1,4 @@ | |||
1 | NOTE: This is only a simulation! | ||
2 | apt-get needs root privileges for real execution. | ||
3 | Keep also in mind that locking is deactivated, | ||
4 | so don't depend on the relevance to the real current situation! | ||
diff --git a/plugins/t/check_apt_input/debian2 b/plugins/t/check_apt_input/debian2 new file mode 100644 index 0000000..effd155 --- /dev/null +++ b/plugins/t/check_apt_input/debian2 | |||
@@ -0,0 +1,37 @@ | |||
1 | NOTE: This is only a simulation! | ||
2 | apt-get needs root privileges for real execution. | ||
3 | Keep also in mind that locking is deactivated, | ||
4 | so don't depend on the relevance to the real current situation! | ||
5 | Reading package lists... Done | ||
6 | Building dependency tree | ||
7 | Reading state information... Done | ||
8 | The following packages will be upgraded: | ||
9 | base-files debian-archive-keyring dpkg firmware-linux-free libc-bin libc-dev-bin libc6 libc6-dev linux-base | ||
10 | linux-image-2.6.32-5-xen-amd64 linux-libc-dev locales lockfile-progs | ||
11 | 13 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. | ||
12 | Inst base-files [6.0squeeze5] (6.0squeeze6 Debian:6.0.6/stable [amd64]) | ||
13 | Conf base-files (6.0squeeze6 Debian:6.0.6/stable [amd64]) | ||
14 | Inst dpkg [1.15.8.12] (1.15.8.13 Debian:6.0.6/stable [amd64]) | ||
15 | Conf dpkg (1.15.8.13 Debian:6.0.6/stable [amd64]) | ||
16 | Inst linux-base [2.6.32-45] (2.6.32-46 Debian:6.0.6/stable [all]) | ||
17 | Inst linux-image-2.6.32-5-xen-amd64 [2.6.32-45] (2.6.32-46 Debian:6.0.6/stable [amd64]) | ||
18 | Inst debian-archive-keyring [2010.08.28] (2010.08.28+squeeze1 Debian:6.0.6/stable [all]) | ||
19 | Conf debian-archive-keyring (2010.08.28+squeeze1 Debian:6.0.6/stable [all]) | ||
20 | Inst libc6-dev [2.11.3-3] (2.11.3-4 Debian:6.0.6/stable [amd64]) [] | ||
21 | Inst libc-dev-bin [2.11.3-3] (2.11.3-4 Debian:6.0.6/stable [amd64]) [] | ||
22 | Inst linux-libc-dev [2.6.32-45] (2.6.32-46 Debian:6.0.6/stable [amd64]) [] | ||
23 | Inst libc-bin [2.11.3-3] (2.11.3-4 Debian:6.0.6/stable [amd64]) [libc6:amd64 ] | ||
24 | Conf libc-bin (2.11.3-4 Debian:6.0.6/stable [amd64]) [libc6:amd64 ] | ||
25 | Inst libc6 [2.11.3-3] (2.11.3-4 Debian:6.0.6/stable [amd64]) | ||
26 | Conf libc6 (2.11.3-4 Debian:6.0.6/stable [amd64]) | ||
27 | Inst locales [2.11.3-3] (2.11.3-4 Debian:6.0.6/stable [all]) | ||
28 | Inst firmware-linux-free [2.6.32-45] (2.6.32-46 Debian:6.0.6/stable [all]) | ||
29 | Inst lockfile-progs [0.1.15] (0.1.15+squeeze1 Debian:6.0.6/stable [amd64]) | ||
30 | Conf linux-base (2.6.32-46 Debian:6.0.6/stable [all]) | ||
31 | Conf linux-image-2.6.32-5-xen-amd64 (2.6.32-46 Debian:6.0.6/stable [amd64]) | ||
32 | Conf libc-dev-bin (2.11.3-4 Debian:6.0.6/stable [amd64]) | ||
33 | Conf linux-libc-dev (2.6.32-46 Debian:6.0.6/stable [amd64]) | ||
34 | Conf libc6-dev (2.11.3-4 Debian:6.0.6/stable [amd64]) | ||
35 | Conf locales (2.11.3-4 Debian:6.0.6/stable [all]) | ||
36 | Conf firmware-linux-free (2.6.32-46 Debian:6.0.6/stable [all]) | ||
37 | Conf lockfile-progs (0.1.15+squeeze1 Debian:6.0.6/stable [amd64]) | ||
diff --git a/plugins/t/check_apt_input/debian3 b/plugins/t/check_apt_input/debian3 new file mode 100644 index 0000000..719dce9 --- /dev/null +++ b/plugins/t/check_apt_input/debian3 | |||
@@ -0,0 +1,42 @@ | |||
1 | NOTE: This is only a simulation! | ||
2 | apt-get needs root privileges for real execution. | ||
3 | Keep also in mind that locking is deactivated, | ||
4 | so don't depend on the relevance to the real current situation! | ||
5 | Inst base-files [6.0squeeze5] (6.0squeeze6 Debian:6.0.6/stable [amd64]) | ||
6 | Conf base-files (6.0squeeze6 Debian:6.0.6/stable [amd64]) | ||
7 | Inst dpkg [1.15.8.12] (1.15.8.13 Debian:6.0.6/stable [amd64]) | ||
8 | Conf dpkg (1.15.8.13 Debian:6.0.6/stable [amd64]) | ||
9 | Inst linux-base [2.6.32-45] (2.6.32-46 Debian:6.0.6/stable [all]) | ||
10 | Inst linux-image-2.6.32-5-amd64 [2.6.32-45] (2.6.32-46 Debian:6.0.6/stable [amd64]) | ||
11 | Inst xen-hypervisor-4.0-amd64 [4.0.1-5.3] (4.0.1-5.4 Debian:6.0.6/stable, Debian-Security:6.0/stable [amd64]) | ||
12 | Inst xen-linux-system-2.6.32-5-xen-amd64 [2.6.32-45] (2.6.32-46 Debian:6.0.6/stable [amd64]) [] | ||
13 | Inst linux-image-2.6.32-5-xen-amd64 [2.6.32-45] (2.6.32-46 Debian:6.0.6/stable [amd64]) | ||
14 | Inst debian-archive-keyring [2010.08.28] (2010.08.28+squeeze1 Debian:6.0.6/stable [all]) | ||
15 | Conf debian-archive-keyring (2010.08.28+squeeze1 Debian:6.0.6/stable [all]) | ||
16 | Inst libc6-i386 [2.11.3-3] (2.11.3-4 Debian:6.0.6/stable [amd64]) [] | ||
17 | Inst libc-bin [2.11.3-3] (2.11.3-4 Debian:6.0.6/stable [amd64]) [libc6:amd64 ] | ||
18 | Conf libc-bin (2.11.3-4 Debian:6.0.6/stable [amd64]) [libc6:amd64 ] | ||
19 | Inst libc6 [2.11.3-3] (2.11.3-4 Debian:6.0.6/stable [amd64]) | ||
20 | Conf libc6 (2.11.3-4 Debian:6.0.6/stable [amd64]) | ||
21 | Inst libgc1c2 [1:6.8-1.2] (1:6.8-2 Debian:6.0.6/stable [amd64]) | ||
22 | Inst locales [2.11.3-3] (2.11.3-4 Debian:6.0.6/stable [all]) | ||
23 | Inst firmware-linux-free [2.6.32-45] (2.6.32-46 Debian:6.0.6/stable [all]) | ||
24 | Inst libxenstore3.0 [4.0.1-5.3] (4.0.1-5.4 Debian:6.0.6/stable, Debian-Security:6.0/stable [amd64]) | ||
25 | Inst lockfile-progs [0.1.15] (0.1.15+squeeze1 Debian:6.0.6/stable [amd64]) | ||
26 | Inst xen-utils-4.0 [4.0.1-5.3] (4.0.1-5.4 Debian:6.0.6/stable, Debian-Security:6.0/stable [amd64]) | ||
27 | Inst xenstore-utils [4.0.1-5.3] (4.0.1-5.4 Debian:6.0.6/stable, Debian-Security:6.0/stable [amd64]) | ||
28 | Inst libconfig-inifiles-perl [2.52-1] (2.52-1+squeeze1 Debian:6.0.6/stable [all]) | ||
29 | Conf linux-base (2.6.32-46 Debian:6.0.6/stable [all]) | ||
30 | Conf linux-image-2.6.32-5-amd64 (2.6.32-46 Debian:6.0.6/stable [amd64]) | ||
31 | Conf xen-hypervisor-4.0-amd64 (4.0.1-5.4 Debian:6.0.6/stable, Debian-Security:6.0/stable [amd64]) | ||
32 | Conf linux-image-2.6.32-5-xen-amd64 (2.6.32-46 Debian:6.0.6/stable [amd64]) | ||
33 | Conf xen-linux-system-2.6.32-5-xen-amd64 (2.6.32-46 Debian:6.0.6/stable [amd64]) | ||
34 | Conf libc6-i386 (2.11.3-4 Debian:6.0.6/stable [amd64]) | ||
35 | Conf libgc1c2 (1:6.8-2 Debian:6.0.6/stable [amd64]) | ||
36 | Conf locales (2.11.3-4 Debian:6.0.6/stable [all]) | ||
37 | Conf firmware-linux-free (2.6.32-46 Debian:6.0.6/stable [all]) | ||
38 | Conf libxenstore3.0 (4.0.1-5.4 Debian:6.0.6/stable, Debian-Security:6.0/stable [amd64]) | ||
39 | Conf lockfile-progs (0.1.15+squeeze1 Debian:6.0.6/stable [amd64]) | ||
40 | Conf xen-utils-4.0 (4.0.1-5.4 Debian:6.0.6/stable, Debian-Security:6.0/stable [amd64]) | ||
41 | Conf xenstore-utils (4.0.1-5.4 Debian:6.0.6/stable, Debian-Security:6.0/stable [amd64]) | ||
42 | Conf libconfig-inifiles-perl (2.52-1+squeeze1 Debian:6.0.6/stable [all]) | ||
diff --git a/plugins/t/check_apt_input/ubuntu1 b/plugins/t/check_apt_input/ubuntu1 new file mode 100644 index 0000000..2f61c30 --- /dev/null +++ b/plugins/t/check_apt_input/ubuntu1 | |||
@@ -0,0 +1,14 @@ | |||
1 | NOTE: This is only a simulation! | ||
2 | apt-get needs root privileges for real execution. | ||
3 | Also keep in mind that locking is deactivated, | ||
4 | so don't depend on the relevance to the real current situation! | ||
5 | Inst grub-pc [1.99-21ubuntu3.1] (1.99-21ubuntu3.4 Ubuntu:12.04/precise-updates [amd64]) [] | ||
6 | Inst grub-pc-bin [1.99-21ubuntu3.1] (1.99-21ubuntu3.4 Ubuntu:12.04/precise-updates [amd64]) [] | ||
7 | Inst grub2-common [1.99-21ubuntu3.1] (1.99-21ubuntu3.4 Ubuntu:12.04/precise-updates [amd64]) [] | ||
8 | Inst grub-efi-amd64-bin [1.99-21ubuntu3.1] (1.99-21ubuntu3.4 Ubuntu:12.04/precise-updates [amd64]) [] | ||
9 | Inst grub-common [1.99-21ubuntu3.1] (1.99-21ubuntu3.4 Ubuntu:12.04/precise-updates [amd64]) | ||
10 | Conf grub-common (1.99-21ubuntu3.4 Ubuntu:12.04/precise-updates [amd64]) | ||
11 | Conf grub2-common (1.99-21ubuntu3.4 Ubuntu:12.04/precise-updates [amd64]) | ||
12 | Conf grub-pc-bin (1.99-21ubuntu3.4 Ubuntu:12.04/precise-updates [amd64]) | ||
13 | Conf grub-pc (1.99-21ubuntu3.4 Ubuntu:12.04/precise-updates [amd64]) | ||
14 | Conf grub-efi-amd64-bin (1.99-21ubuntu3.4 Ubuntu:12.04/precise-updates [amd64]) | ||
diff --git a/plugins/t/check_apt_input/ubuntu2 b/plugins/t/check_apt_input/ubuntu2 new file mode 100644 index 0000000..29a14a0 --- /dev/null +++ b/plugins/t/check_apt_input/ubuntu2 | |||
@@ -0,0 +1,54 @@ | |||
1 | NOTE: This is only a simulation! | ||
2 | apt-get needs root privileges for real execution. | ||
3 | Also keep in mind that locking is deactivated, | ||
4 | so don't depend on the relevance to the real current situation! | ||
5 | Inst libc6-dev [2.15-0ubuntu10] (2.15-0ubuntu10.2 Ubuntu:12.04/precise-security [amd64]) [] | ||
6 | Inst libc-dev-bin [2.15-0ubuntu10] (2.15-0ubuntu10.2 Ubuntu:12.04/precise-security [amd64]) [] | ||
7 | Inst linux-libc-dev [3.2.0-29.46] (3.2.0-31.50 Ubuntu:12.04/precise-security [amd64]) [] | ||
8 | Inst tzdata [2012e-0ubuntu0.12.04] (2012e-0ubuntu0.12.04.1 Ubuntu:12.04/precise-security [all]) [] | ||
9 | Conf tzdata (2012e-0ubuntu0.12.04.1 Ubuntu:12.04/precise-security [all]) [] | ||
10 | Inst libc-bin [2.15-0ubuntu10] (2.15-0ubuntu10.2 Ubuntu:12.04/precise-security [amd64]) [libc6:amd64 ] | ||
11 | Conf libc-bin (2.15-0ubuntu10.2 Ubuntu:12.04/precise-security [amd64]) [libc6:amd64 ] | ||
12 | Inst libc6 [2.15-0ubuntu10] (2.15-0ubuntu10.2 Ubuntu:12.04/precise-security [amd64]) | ||
13 | Conf libc6 (2.15-0ubuntu10.2 Ubuntu:12.04/precise-security [amd64]) | ||
14 | Inst libapt-pkg4.12 [0.8.16~exp12ubuntu10.2] (0.8.16~exp12ubuntu10.3 Ubuntu:12.04/precise-updates [amd64]) | ||
15 | Conf libapt-pkg4.12 (0.8.16~exp12ubuntu10.3 Ubuntu:12.04/precise-updates [amd64]) | ||
16 | Inst ubuntu-keyring [2011.11.21] (2011.11.21.1 Ubuntu:12.04/precise-updates [all]) | ||
17 | Conf ubuntu-keyring (2011.11.21.1 Ubuntu:12.04/precise-updates [all]) | ||
18 | Inst gpgv [1.4.11-3ubuntu2] (1.4.11-3ubuntu2.1 Ubuntu:12.04/precise-security [amd64]) | ||
19 | Conf gpgv (1.4.11-3ubuntu2.1 Ubuntu:12.04/precise-security [amd64]) | ||
20 | Inst gnupg [1.4.11-3ubuntu2] (1.4.11-3ubuntu2.1 Ubuntu:12.04/precise-security [amd64]) | ||
21 | Conf gnupg (1.4.11-3ubuntu2.1 Ubuntu:12.04/precise-security [amd64]) | ||
22 | Inst apt [0.8.16~exp12ubuntu10.2] (0.8.16~exp12ubuntu10.3 Ubuntu:12.04/precise-updates [amd64]) | ||
23 | Conf apt (0.8.16~exp12ubuntu10.3 Ubuntu:12.04/precise-updates [amd64]) | ||
24 | Inst libssl1.0.0 [1.0.1-4ubuntu5.3] (1.0.1-4ubuntu5.5 Ubuntu:12.04/precise-updates [amd64]) | ||
25 | Conf libssl1.0.0 (1.0.1-4ubuntu5.5 Ubuntu:12.04/precise-updates [amd64]) | ||
26 | Inst libapt-inst1.4 [0.8.16~exp12ubuntu10.2] (0.8.16~exp12ubuntu10.3 Ubuntu:12.04/precise-updates [amd64]) | ||
27 | Inst resolvconf [1.63ubuntu15] (1.63ubuntu16 Ubuntu:12.04/precise-updates [all]) | ||
28 | Inst libdbus-1-3 [1.4.18-1ubuntu1] (1.4.18-1ubuntu1.1 Ubuntu:12.04/precise-security [amd64]) | ||
29 | Inst libxml2 [2.7.8.dfsg-5.1ubuntu4.1] (2.7.8.dfsg-5.1ubuntu4.2 Ubuntu:12.04/precise-security [amd64]) | ||
30 | Inst multiarch-support [2.15-0ubuntu10] (2.15-0ubuntu10.2 Ubuntu:12.04/precise-security [amd64]) | ||
31 | Conf multiarch-support (2.15-0ubuntu10.2 Ubuntu:12.04/precise-security [amd64]) | ||
32 | Inst apt-utils [0.8.16~exp12ubuntu10.2] (0.8.16~exp12ubuntu10.3 Ubuntu:12.04/precise-updates [amd64]) | ||
33 | Inst isc-dhcp-client [4.1.ESV-R4-0ubuntu5.2] (4.1.ESV-R4-0ubuntu5.5 Ubuntu:12.04/precise-security [amd64]) [] | ||
34 | Inst isc-dhcp-common [4.1.ESV-R4-0ubuntu5.2] (4.1.ESV-R4-0ubuntu5.5 Ubuntu:12.04/precise-security [amd64]) | ||
35 | Inst dbus [1.4.18-1ubuntu1] (1.4.18-1ubuntu1.1 Ubuntu:12.04/precise-security [amd64]) | ||
36 | Inst linux-firmware [1.79] (1.79.1 Ubuntu:12.04/precise-updates [all]) | ||
37 | Inst xserver-common [2:1.11.4-0ubuntu10.7] (2:1.11.4-0ubuntu10.8 Ubuntu:12.04/precise-updates [all]) | ||
38 | Inst xserver-xorg-core [2:1.11.4-0ubuntu10.7] (2:1.11.4-0ubuntu10.8 Ubuntu:12.04/precise-updates [amd64]) | ||
39 | Inst xserver-xorg-input-synaptics [1.6.2-1ubuntu1~precise1] (1.6.2-1ubuntu1~precise2 Ubuntu:12.04/precise-updates [amd64]) | ||
40 | Conf libc-dev-bin (2.15-0ubuntu10.2 Ubuntu:12.04/precise-security [amd64]) | ||
41 | Conf linux-libc-dev (3.2.0-31.50 Ubuntu:12.04/precise-security [amd64]) | ||
42 | Conf libc6-dev (2.15-0ubuntu10.2 Ubuntu:12.04/precise-security [amd64]) | ||
43 | Conf libapt-inst1.4 (0.8.16~exp12ubuntu10.3 Ubuntu:12.04/precise-updates [amd64]) | ||
44 | Conf resolvconf (1.63ubuntu16 Ubuntu:12.04/precise-updates [all]) | ||
45 | Conf libdbus-1-3 (1.4.18-1ubuntu1.1 Ubuntu:12.04/precise-security [amd64]) | ||
46 | Conf libxml2 (2.7.8.dfsg-5.1ubuntu4.2 Ubuntu:12.04/precise-security [amd64]) | ||
47 | Conf apt-utils (0.8.16~exp12ubuntu10.3 Ubuntu:12.04/precise-updates [amd64]) | ||
48 | Conf isc-dhcp-common (4.1.ESV-R4-0ubuntu5.5 Ubuntu:12.04/precise-security [amd64]) | ||
49 | Conf isc-dhcp-client (4.1.ESV-R4-0ubuntu5.5 Ubuntu:12.04/precise-security [amd64]) | ||
50 | Conf dbus (1.4.18-1ubuntu1.1 Ubuntu:12.04/precise-security [amd64]) | ||
51 | Conf linux-firmware (1.79.1 Ubuntu:12.04/precise-updates [all]) | ||
52 | Conf xserver-common (2:1.11.4-0ubuntu10.8 Ubuntu:12.04/precise-updates [all]) | ||
53 | Conf xserver-xorg-core (2:1.11.4-0ubuntu10.8 Ubuntu:12.04/precise-updates [amd64]) | ||
54 | Conf xserver-xorg-input-synaptics (1.6.2-1ubuntu1~precise2 Ubuntu:12.04/precise-updates [amd64]) | ||
diff --git a/plugins/t/check_dig.t b/plugins/t/check_dig.t index 323859e..1ab4b42 100644 --- a/plugins/t/check_dig.t +++ b/plugins/t/check_dig.t | |||
@@ -10,30 +10,30 @@ use NPTest; | |||
10 | 10 | ||
11 | plan skip_all => "check_dig not compiled" unless (-x "check_dig"); | 11 | plan skip_all => "check_dig not compiled" unless (-x "check_dig"); |
12 | 12 | ||
13 | plan tests => 12; | 13 | plan tests => 16; |
14 | 14 | ||
15 | my $successOutput = '/DNS OK - [\.0-9]+ seconds? response time/'; | 15 | my $successOutput = '/DNS OK - [\.0-9]+ seconds? response time/'; |
16 | 16 | ||
17 | my $hostname_valid = getTestParameter( | 17 | my $hostname_valid = getTestParameter( |
18 | "NP_HOSTNAME_VALID", | 18 | "NP_HOSTNAME_VALID", |
19 | "A valid (known to DNS) hostname", | 19 | "A valid (known to DNS) hostname", |
20 | "nagios.com" | 20 | "nagiosplugins.org" |
21 | ); | 21 | ); |
22 | 22 | ||
23 | my $hostname_valid_ip = getTestParameter( | 23 | my $hostname_valid_ip = getTestParameter( |
24 | "NP_HOSTNAME_VALID_IP", | 24 | "NP_HOSTNAME_VALID_IP", |
25 | "The IP address of the valid hostname $hostname_valid", | 25 | "The IP address of the valid hostname $hostname_valid", |
26 | "66.118.156.50", | 26 | "67.207.143.200", |
27 | ); | 27 | ); |
28 | 28 | ||
29 | my $hostname_valid_reverse = getTestParameter( | 29 | my $hostname_valid_reverse = getTestParameter( |
30 | "NP_HOSTNAME_VALID_REVERSE", | 30 | "NP_HOSTNAME_VALID_REVERSE", |
31 | "The hostname of $hostname_valid_ip", | 31 | "The hostname of $hostname_valid_ip", |
32 | "66-118-156-50.static.sagonet.net.", | 32 | "nagiosplugins.org.", |
33 | ); | 33 | ); |
34 | 34 | ||
35 | my $hostname_invalid = getTestParameter( | 35 | my $hostname_invalid = getTestParameter( |
36 | "NP_HOSTNAME_INVALID", | 36 | "NP_HOSTNAME_INVALID", |
37 | "An invalid (not known to DNS) hostname", | 37 | "An invalid (not known to DNS) hostname", |
38 | "nosuchhost.altinity.com", | 38 | "nosuchhost.altinity.com", |
39 | ); | 39 | ); |
@@ -69,6 +69,14 @@ SKIP: { | |||
69 | cmp_ok( $res->return_code, '==', 0, "Found $hostname_valid on $dns_server"); | 69 | cmp_ok( $res->return_code, '==', 0, "Found $hostname_valid on $dns_server"); |
70 | like ( $res->output, $successOutput, "Output OK" ); | 70 | like ( $res->output, $successOutput, "Output OK" ); |
71 | 71 | ||
72 | $res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -t 5 -4"); | ||
73 | cmp_ok( $res->return_code, '==', 0, "Found $hostname_valid on $dns_server"); | ||
74 | like ( $res->output, $successOutput, "Output OK for IPv4" ); | ||
75 | |||
76 | $res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -t 5 -6"); | ||
77 | cmp_ok( $res->return_code, '==', 0, "Found $hostname_valid on $dns_server"); | ||
78 | like ( $res->output, $successOutput, "Output OK for IPv6" ); | ||
79 | |||
72 | $res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -a $hostname_valid_ip -t 5"); | 80 | $res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -a $hostname_valid_ip -t 5"); |
73 | cmp_ok( $res->return_code, '==', 0, "Got expected address"); | 81 | cmp_ok( $res->return_code, '==', 0, "Got expected address"); |
74 | 82 | ||
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t index 0a25c77..9948c53 100644 --- a/plugins/t/check_http.t +++ b/plugins/t/check_http.t | |||
@@ -8,22 +8,22 @@ use strict; | |||
8 | use Test::More; | 8 | use Test::More; |
9 | use NPTest; | 9 | use NPTest; |
10 | 10 | ||
11 | plan tests => 28; | 11 | plan tests => 30; |
12 | 12 | ||
13 | my $successOutput = '/OK.*HTTP.*second/'; | 13 | my $successOutput = '/OK.*HTTP.*second/'; |
14 | 14 | ||
15 | my $res; | 15 | my $res; |
16 | 16 | ||
17 | my $host_tcp_http = getTestParameter( "NP_HOST_TCP_HTTP", | 17 | my $host_tcp_http = getTestParameter( "NP_HOST_TCP_HTTP", |
18 | "A host providing the HTTP Service (a web server)", | 18 | "A host providing the HTTP Service (a web server)", |
19 | "localhost" ); | 19 | "localhost" ); |
20 | 20 | ||
21 | my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE", | 21 | my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE", |
22 | "The hostname of system not responsive to network requests", | 22 | "The hostname of system not responsive to network requests", |
23 | "10.0.0.1" ); | 23 | "10.0.0.1" ); |
24 | 24 | ||
25 | my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID", | 25 | my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID", |
26 | "An invalid (not known to DNS) hostname", | 26 | "An invalid (not known to DNS) hostname", |
27 | "nosuchhost"); | 27 | "nosuchhost"); |
28 | 28 | ||
29 | my $internet_access = getTestParameter( "NP_INTERNET_ACCESS", | 29 | my $internet_access = getTestParameter( "NP_INTERNET_ACCESS", |
@@ -32,8 +32,8 @@ my $internet_access = getTestParameter( "NP_INTERNET_ACCESS", | |||
32 | 32 | ||
33 | my $host_tcp_http2; | 33 | my $host_tcp_http2; |
34 | if ($internet_access eq "no") { | 34 | if ($internet_access eq "no") { |
35 | $host_tcp_http2 = getTestParameter( "NP_HOST_TCP_HTTP2", | 35 | $host_tcp_http2 = getTestParameter( "NP_HOST_TCP_HTTP2", |
36 | "A host providing an index page containing the string 'nagios'", | 36 | "A host providing an index page containing the string 'nagios'", |
37 | "www.nagios.com" ); | 37 | "www.nagios.com" ); |
38 | } | 38 | } |
39 | 39 | ||
@@ -45,14 +45,9 @@ cmp_ok( $res->return_code, '==', 0, "Webserver $host_tcp_http responded" ); | |||
45 | like( $res->output, $successOutput, "Output OK" ); | 45 | like( $res->output, $successOutput, "Output OK" ); |
46 | 46 | ||
47 | $res = NPTest->testCmd( | 47 | $res = NPTest->testCmd( |
48 | "./check_http $host_tcp_http -wt 300 -ct 600 -v -v -v -k 'bob:there;fred:here'" | 48 | "./check_http $host_tcp_http -wt 300 -ct 600 -v -v -v -k 'bob:there' -k 'carl:frown'" |
49 | ); | 49 | ); |
50 | like( $res->output, '/bob:there\r\nfred:here\r\n/', "Got headers, delimited with ';'" ); | 50 | like( $res->output, '/bob:there\r\ncarl:frown\r\n/', "Got headers with multiple -k options" ); |
51 | |||
52 | $res = NPTest->testCmd( | ||
53 | "./check_http $host_tcp_http -wt 300 -ct 600 -v -v -v -k 'bob:there;fred:here' -k 'carl:frown'" | ||
54 | ); | ||
55 | like( $res->output, '/bob:there\r\nfred:here\r\ncarl:frown\r\n/', "Got headers with multiple -k options" ); | ||
56 | 51 | ||
57 | $res = NPTest->testCmd( | 52 | $res = NPTest->testCmd( |
58 | "./check_http $host_nonresponsive -wt 1 -ct 2" | 53 | "./check_http $host_nonresponsive -wt 1 -ct 2" |
@@ -123,6 +118,10 @@ SKIP: { | |||
123 | $res = NPTest->testCmd( "./check_http www.verisign.com -C 1" ); | 118 | $res = NPTest->testCmd( "./check_http www.verisign.com -C 1" ); |
124 | cmp_ok( $res->output, 'eq', $saved_cert_output, "Old syntax for cert checking still works"); | 119 | cmp_ok( $res->output, 'eq', $saved_cert_output, "Old syntax for cert checking still works"); |
125 | 120 | ||
121 | $res = NPTest->testCmd( "./check_http --ssl www.verisign.com -E" ); | ||
122 | like ( $res->output, '/time_connect=[\d\.]+/', 'Extended Performance Data Output OK' ); | ||
123 | like ( $res->output, '/time_ssl=[\d\.]+/', 'Extended Performance Data SSL Output OK' ); | ||
124 | |||
126 | $res = NPTest->testCmd( | 125 | $res = NPTest->testCmd( |
127 | "./check_http --ssl www.e-paycobalt.com" | 126 | "./check_http --ssl www.e-paycobalt.com" |
128 | ); | 127 | ); |
@@ -131,4 +130,7 @@ SKIP: { | |||
131 | 130 | ||
132 | $res = NPTest->testCmd( "./check_http -H www.mozilla.com -u /firefox -f follow" ); | 131 | $res = NPTest->testCmd( "./check_http -H www.mozilla.com -u /firefox -f follow" ); |
133 | is( $res->return_code, 0, "Redirection based on location is okay"); | 132 | is( $res->return_code, 0, "Redirection based on location is okay"); |
133 | |||
134 | $res = NPTest->testCmd( "./check_http -H www.mozilla.com --extended-perfdata" ); | ||
135 | like ( $res->output, '/time_connect=[\d\.]+/', 'Extended Performance Data Output OK' ); | ||
134 | } | 136 | } |
diff --git a/plugins/t/check_procs.t b/plugins/t/check_procs.t index 30f0248..a1a2883 100644 --- a/plugins/t/check_procs.t +++ b/plugins/t/check_procs.t | |||
@@ -20,7 +20,7 @@ my $result; | |||
20 | 20 | ||
21 | $result = NPTest->testCmd( "./check_procs -w 100000 -c 100000" ); | 21 | $result = NPTest->testCmd( "./check_procs -w 100000 -c 100000" ); |
22 | is( $result->return_code, 0, "Checking less than 10000 processes" ); | 22 | is( $result->return_code, 0, "Checking less than 10000 processes" ); |
23 | like( $result->output, '/^PROCS OK: [0-9]+ process(es)?$/', "Output correct" ); | 23 | like( $result->output, '/^PROCS OK: [0-9]+ process(es)? | procs=[0-9]+;100000;100000;0;$/', "Output correct" ); |
24 | 24 | ||
25 | $result = NPTest->testCmd( "./check_procs -w 100000 -c 100000 -s Z" ); | 25 | $result = NPTest->testCmd( "./check_procs -w 100000 -c 100000 -s Z" ); |
26 | is( $result->return_code, 0, "Checking less than 100000 zombie processes" ); | 26 | is( $result->return_code, 0, "Checking less than 100000 zombie processes" ); |
@@ -28,11 +28,11 @@ like( $result->output, '/^PROCS OK: [0-9]+ process(es)? with /', "Output correct | |||
28 | 28 | ||
29 | $result = NPTest->testCmd( "./check_procs -w 0 -c 100000" ); | 29 | $result = NPTest->testCmd( "./check_procs -w 0 -c 100000" ); |
30 | is( $result->return_code, 1, "Checking warning if processes > 0" ); | 30 | is( $result->return_code, 1, "Checking warning if processes > 0" ); |
31 | like( $result->output, '/^PROCS WARNING: [0-9]+ process(es)?$/', "Output correct" ); | 31 | like( $result->output, '/^PROCS WARNING: [0-9]+ process(es)? | procs=[0-9]+;0;100000;0;$/', "Output correct" ); |
32 | 32 | ||
33 | $result = NPTest->testCmd( "./check_procs -w 0 -c 0" ); | 33 | $result = NPTest->testCmd( "./check_procs -w 0 -c 0" ); |
34 | is( $result->return_code, 2, "Checking critical if processes > 0" ); | 34 | is( $result->return_code, 2, "Checking critical if processes > 0" ); |
35 | like( $result->output, '/^PROCS CRITICAL: [0-9]+ process(es)?$/', "Output correct" ); | 35 | like( $result->output, '/^PROCS CRITICAL: [0-9]+ process(es)? | procs=[0-9]+;0;0;0;$/', "Output correct" ); |
36 | 36 | ||
37 | $result = NPTest->testCmd( "./check_procs -w 0 -c 0 -s S" ); | 37 | $result = NPTest->testCmd( "./check_procs -w 0 -c 0 -s S" ); |
38 | is( $result->return_code, 2, "Checking critical if sleeping processes" ); | 38 | is( $result->return_code, 2, "Checking critical if sleeping processes" ); |
diff --git a/plugins/t/check_tcp.t b/plugins/t/check_tcp.t index 75c1e5f..d6808bf 100644 --- a/plugins/t/check_tcp.t +++ b/plugins/t/check_tcp.t | |||
@@ -9,7 +9,7 @@ use Test; | |||
9 | use NPTest; | 9 | use NPTest; |
10 | 10 | ||
11 | use vars qw($tests); | 11 | use vars qw($tests); |
12 | BEGIN {$tests = 7; plan tests => $tests} | 12 | BEGIN {$tests = 14; plan tests => $tests} |
13 | 13 | ||
14 | my $host_tcp_http = getTestParameter( "host_tcp_http", "NP_HOST_TCP_HTTP", "localhost", | 14 | my $host_tcp_http = getTestParameter( "host_tcp_http", "NP_HOST_TCP_HTTP", "localhost", |
15 | "A host providing the HTTP Service (a web server)" ); | 15 | "A host providing the HTTP Service (a web server)" ); |
@@ -27,6 +27,7 @@ my $failedExpect = '/^TCP WARNING\s-\sUnexpected response from host/socket on po | |||
27 | my $t; | 27 | my $t; |
28 | 28 | ||
29 | $t += checkCmd( "./check_tcp $host_tcp_http -p 80 -wt 300 -ct 600", 0, $successOutput ); | 29 | $t += checkCmd( "./check_tcp $host_tcp_http -p 80 -wt 300 -ct 600", 0, $successOutput ); |
30 | $t += checkCmd( "./check_tcp $host_tcp_http -p 80 -wt 300 -ct 600 -6 ", 0, $successOutput ); | ||
30 | $t += checkCmd( "./check_tcp $host_tcp_http -p 81 -wt 0 -ct 0 -to 1", 2 ); # use invalid port for this test | 31 | $t += checkCmd( "./check_tcp $host_tcp_http -p 81 -wt 0 -ct 0 -to 1", 2 ); # use invalid port for this test |
31 | $t += checkCmd( "./check_tcp $host_nonresponsive -p 80 -wt 0 -ct 0 -to 1", 2 ); | 32 | $t += checkCmd( "./check_tcp $host_nonresponsive -p 80 -wt 0 -ct 0 -to 1", 2 ); |
32 | $t += checkCmd( "./check_tcp $hostname_invalid -p 80 -wt 0 -ct 0 -to 1", 2 ); | 33 | $t += checkCmd( "./check_tcp $hostname_invalid -p 80 -wt 0 -ct 0 -to 1", 2 ); |
@@ -34,6 +35,7 @@ $t += checkCmd( "./check_tcp -S -D 1 -H www.verisign.com -p 443", 0 | |||
34 | $t += checkCmd( "./check_tcp -S -D 9000,1 -H www.verisign.com -p 443", 0 ); | 35 | $t += checkCmd( "./check_tcp -S -D 9000,1 -H www.verisign.com -p 443", 0 ); |
35 | $t += checkCmd( "./check_tcp -S -D 9000 -H www.verisign.com -p 443", 1 ); | 36 | $t += checkCmd( "./check_tcp -S -D 9000 -H www.verisign.com -p 443", 1 ); |
36 | $t += checkCmd( "./check_tcp -S -D 9000,8999 -H www.verisign.com -p 443", 2 ); | 37 | $t += checkCmd( "./check_tcp -S -D 9000,8999 -H www.verisign.com -p 443", 2 ); |
38 | $t += checkCmd( "./check_tcp -6 -p 80 www.heise.de", 0 ); | ||
37 | 39 | ||
38 | # Need the \r\n to make it more standards compliant with web servers. Need the various quotes | 40 | # Need the \r\n to make it more standards compliant with web servers. Need the various quotes |
39 | # so that perl doesn't interpret the \r\n and is passed onto command line correctly | 41 | # so that perl doesn't interpret the \r\n and is passed onto command line correctly |