summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t')
-rw-r--r--plugins/t/check_disk.t15
-rw-r--r--plugins/t/check_ldap.t14
-rw-r--r--plugins/t/check_ntp.t2
3 files changed, 21 insertions, 10 deletions
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t
index 0f62fb2b..72a83ea4 100644
--- a/plugins/t/check_disk.t
+++ b/plugins/t/check_disk.t
@@ -80,14 +80,25 @@ if($free_percent_on_mp1 == $avg_free_percent || $free_percent_on_mp2 == $avg_fre
80 die "One mountpoints has average space free - cannot do rest of test"; 80 die "One mountpoints has average space free - cannot do rest of test";
81} 81}
82 82
83my $free_inodes_on_mp1 = $result->{'mp_test_result'}->{'checks'}->[1]->{'checks'}[2]->{'perfdata'}->[0]->{'value'}->{'value'}; 83my $used_inodes_on_mp1 = $result->{'mp_test_result'}->{'checks'}->[1]->{'checks'}[2]->{'perfdata'}->[0]->{'value'}->{'value'};
84my $total_inodes_on_mp1 = $result->{'mp_test_result'}->{'checks'}->[1]->{'checks'}[2]->{'perfdata'}->[0]->{'max'}->{'value'}; 84my $total_inodes_on_mp1 = $result->{'mp_test_result'}->{'checks'}->[1]->{'checks'}[2]->{'perfdata'}->[0]->{'max'}->{'value'};
85
86my $free_inodes_on_mp1 = $total_inodes_on_mp1 - $used_inodes_on_mp1;
85my $free_inode_percentage_on_mp1 = $free_inodes_on_mp1 / ($total_inodes_on_mp1 / 100); 87my $free_inode_percentage_on_mp1 = $free_inodes_on_mp1 / ($total_inodes_on_mp1 / 100);
86 88
87my $free_inodes_on_mp2 = $result->{'mp_test_result'}->{'checks'}->[0]->{'checks'}[2]->{'perfdata'}->[0]->{'value'}->{'value'}; 89# print("free inodes on mp1: " . $free_inodes_on_mp1 . "\n");
90# print("total inodes on mp1: " . $total_inodes_on_mp1 . "\n");
91# print("free inode percentage on mp1: " . $free_inode_percentage_on_mp1 . "\n");
92
93my $used_inodes_on_mp2 = $result->{'mp_test_result'}->{'checks'}->[0]->{'checks'}[2]->{'perfdata'}->[0]->{'value'}->{'value'};
88my $total_inodes_on_mp2 = $result->{'mp_test_result'}->{'checks'}->[0]->{'checks'}[2]->{'perfdata'}->[0]->{'max'}->{'value'}; 94my $total_inodes_on_mp2 = $result->{'mp_test_result'}->{'checks'}->[0]->{'checks'}[2]->{'perfdata'}->[0]->{'max'}->{'value'};
95my $free_inodes_on_mp2 = $total_inodes_on_mp2 - $used_inodes_on_mp2;
89my $free_inode_percentage_on_mp2 = $free_inodes_on_mp2 / ($total_inodes_on_mp2 / 100); 96my $free_inode_percentage_on_mp2 = $free_inodes_on_mp2 / ($total_inodes_on_mp2 / 100);
90 97
98# print("free inodes on mp2: " . $free_inodes_on_mp2 . "\n");
99# print("total inodes on mp2: " . $total_inodes_on_mp2 . "\n");
100# print("free inode percentage on mp2: " . $free_inode_percentage_on_mp2 . "\n");
101
91my $avg_inode_free_percentage = ceil(($free_inode_percentage_on_mp1 + $free_inode_percentage_on_mp2)/2); 102my $avg_inode_free_percentage = ceil(($free_inode_percentage_on_mp1 + $free_inode_percentage_on_mp2)/2);
92my ($more_inode_free, $less_inode_free); 103my ($more_inode_free, $less_inode_free);
93if ($free_inode_percentage_on_mp1 > $free_inode_percentage_on_mp2) { 104if ($free_inode_percentage_on_mp1 > $free_inode_percentage_on_mp2) {
diff --git a/plugins/t/check_ldap.t b/plugins/t/check_ldap.t
index fcba0393..f3162ebb 100644
--- a/plugins/t/check_ldap.t
+++ b/plugins/t/check_ldap.t
@@ -32,7 +32,7 @@ SKIP: {
32 32
33 $result = NPTest->testCmd("$command -H $hostname_invalid -b ou=blah -t 5"); 33 $result = NPTest->testCmd("$command -H $hostname_invalid -b ou=blah -t 5");
34 is( $result->return_code, 2, "$command -H $hostname_invalid -b ou=blah -t 5" ); 34 is( $result->return_code, 2, "$command -H $hostname_invalid -b ou=blah -t 5" );
35 is( $result->output, 'Could not bind to the LDAP server', "output ok" ); 35 like( $result->output, '/could not bind to the LDAP server/', "output ok" );
36}; 36};
37 37
38SKIP: { 38SKIP: {
@@ -42,30 +42,30 @@ SKIP: {
42 $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3"; 42 $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3";
43 $result = NPTest->testCmd($cmd); 43 $result = NPTest->testCmd($cmd);
44 is( $result->return_code, 0, $cmd ); 44 is( $result->return_code, 0, $cmd );
45 like( $result->output, '/^LDAP OK - \d+.\d+ seconds response time\|time=\d+\.\d+s;2\.0+;3\.0+;0\.0+$/', "output ok" ); 45 like( $result->output, '/connection time \d+.\d+s/', "output ok" );
46 46
47 $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -W 10000000 -C 10000001"; 47 $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -W 10000000 -C 10000001";
48 $result = NPTest->testCmd($cmd); 48 $result = NPTest->testCmd($cmd);
49 is( $result->return_code, 0, $cmd ); 49 is( $result->return_code, 0, $cmd );
50 like( $result->output, '/^LDAP OK - found \d+ entries in \d+\.\d+ seconds\|time=\d\.\d+s;2\.0+;3\.0+;0\.0+ entries=\d+\.0+;10000000;10000001;0\.0+$/', "output ok" ); 50 like( $result->output, '/found \d+ entries/', "output ok" );
51 51
52 $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -W 10000000: -C 10000001:"; 52 $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -W 10000000: -C 10000001:";
53 $result = NPTest->testCmd($cmd); 53 $result = NPTest->testCmd($cmd);
54 is( $result->return_code, 2, $cmd ); 54 is( $result->return_code, 2, $cmd );
55 like( $result->output, '/^LDAP CRITICAL - found \d+ entries in \d+\.\d+ seconds\|time=\d\.\d+s;2\.0+;3\.0+;0\.0+ entries=\d+\.0+;10000000:;10000001:;0\.0+$/', "output ok" ); 55 like( $result->output, '/found \d+ entries/', "output ok" );
56 56
57 $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -W 0 -C 0"; 57 $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -W 0 -C 0";
58 $result = NPTest->testCmd($cmd); 58 $result = NPTest->testCmd($cmd);
59 is( $result->return_code, 2, $cmd ); 59 is( $result->return_code, 2, $cmd );
60 like( $result->output, '/^LDAP CRITICAL - found \d+ entries in \d+\.\d+ seconds\|time=\d\.\d+s;2\.0+;3\.0+;0\.0+ entries=\d+\.0+;0;0;0\.0+$/', "output ok" ); 60 like( $result->output, '/found \d+ entries/', "output ok" );
61 61
62 $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -W 10000000: -C 10000001"; 62 $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -W 10000000: -C 10000001";
63 $result = NPTest->testCmd($cmd); 63 $result = NPTest->testCmd($cmd);
64 is( $result->return_code, 1, $cmd ); 64 is( $result->return_code, 1, $cmd );
65 like( $result->output, '/^LDAP WARNING - found \d+ entries in \d+\.\d+ seconds\|time=\d\.\d+s;2\.0+;3\.0+;0\.0+ entries=\d+\.0+;10000000:;10000001;0\.0+$/', "output ok" ); 65 like( $result->output, '/found \d+ entries/', "output ok" );
66 66
67 $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -C 10000001"; 67 $cmd = "$command -H $host_tcp_ldap -b $ldap_base_dn -t 5 -w 2 -c 3 -3 -C 10000001";
68 $result = NPTest->testCmd($cmd); 68 $result = NPTest->testCmd($cmd);
69 is( $result->return_code, 0, $cmd ); 69 is( $result->return_code, 0, $cmd );
70 like( $result->output, '/^LDAP OK - found \d+ entries in \d+\.\d+ seconds\|time=\d\.\d+s;2\.0+;3\.0+;0\.0+ entries=\d+\.0+;;10000001;0\.0+$/', "output ok" ); 70 like( $result->output, '/found \d+ entries/', "output ok" );
71}; 71};
diff --git a/plugins/t/check_ntp.t b/plugins/t/check_ntp.t
index a8ac7bb8..7703bc3b 100644
--- a/plugins/t/check_ntp.t
+++ b/plugins/t/check_ntp.t
@@ -8,7 +8,7 @@ use strict;
8use Test::More; 8use Test::More;
9use NPTest; 9use NPTest;
10 10
11my @PLUGINS1 = ('check_ntp', 'check_ntp_peer', 'check_ntp_time'); 11my @PLUGINS1 = ('check_ntp_peer', 'check_ntp_time');
12my @PLUGINS2 = ('check_ntp_peer'); 12my @PLUGINS2 = ('check_ntp_peer');
13 13
14plan tests => (12 * scalar(@PLUGINS1)) + (6 * scalar(@PLUGINS2)); 14plan tests => (12 * scalar(@PLUGINS1)) + (6 * scalar(@PLUGINS2));