diff options
Diffstat (limited to 'plugins/t')
-rw-r--r-- | plugins/t/NPTest.cache.travis | 56 | ||||
-rw-r--r-- | plugins/t/check_dns.t | 3 | ||||
-rw-r--r-- | plugins/t/check_fping.t | 14 | ||||
-rw-r--r-- | plugins/t/check_hpjd.t | 35 | ||||
-rw-r--r-- | plugins/t/check_jabber.t | 6 | ||||
-rw-r--r-- | plugins/t/check_ntp.t | 14 | ||||
-rw-r--r-- | plugins/t/check_procs.t | 2 | ||||
-rw-r--r-- | plugins/t/check_snmp.t | 2 | ||||
-rw-r--r-- | plugins/t/check_udp.t | 2 |
9 files changed, 107 insertions, 27 deletions
diff --git a/plugins/t/NPTest.cache.travis b/plugins/t/NPTest.cache.travis new file mode 100644 index 00000000..4ebfb90e --- /dev/null +++ b/plugins/t/NPTest.cache.travis | |||
@@ -0,0 +1,56 @@ | |||
1 | { | ||
2 | 'MYSQL_LOGIN_DETAILS' => '-u root -d test', | ||
3 | 'NP_ALLOW_SUDO' => 'yes', | ||
4 | 'NP_DNS_SERVER' => '8.8.8.8', | ||
5 | 'NP_GOOD_NTP_SERVICE' => '', | ||
6 | 'NP_HOSTNAME_INVALID' => 'nosuchhost', | ||
7 | 'NP_HOSTNAME_VALID' => 'monitoringplugins.org', | ||
8 | 'NP_HOSTNAME_VALID_IP' => '130.133.8.40', | ||
9 | 'NP_HOSTNAME_VALID_REVERSE' => 'orwell.monitoring-plugins.org.', | ||
10 | 'NP_HOST_DHCP_RESPONSIVE' => '', | ||
11 | 'NP_HOST_NONRESPONSIVE' => '10.0.0.1', | ||
12 | 'NP_HOST_RESPONSIVE' => 'localhost', | ||
13 | 'NP_HOST_SMB' => '', | ||
14 | 'NP_HOST_SNMP' => '', | ||
15 | 'NP_HOST_TCP_FTP' => '', | ||
16 | 'NP_HOST_TCP_HPJD' => '', | ||
17 | 'NP_HOST_HPJD_PORT_INVALID' => '161', | ||
18 | 'NP_HOST_HPJD_PORT_VALID' => '', | ||
19 | 'NP_HOST_TCP_HTTP' => 'localhost', | ||
20 | 'NP_HOST_TCP_HTTP2' => 'labs.consol.de', | ||
21 | 'NP_HOST_TCP_IMAP' => 'imap.web.de', | ||
22 | 'NP_HOST_TCP_POP' => 'pop.web.de', | ||
23 | 'NP_HOST_TCP_SMTP' => 'localhost', | ||
24 | 'NP_HOST_TCP_SMTP_NOTLS' => '', | ||
25 | 'NP_HOST_TCP_SMTP_TLS' => '', | ||
26 | 'NP_INTERNET_ACCESS' => 'yes', | ||
27 | 'NP_MOUNTPOINT2_VALID' => '', | ||
28 | 'NP_MOUNTPOINT_VALID' => '/', | ||
29 | 'NP_MYSQL_SERVER' => 'localhost', | ||
30 | 'NP_HOST_UDP_TIME' => 'localhost', | ||
31 | 'NP_MYSQL_SOCKET' => '/var/run/mysqld/mysqld.sock', | ||
32 | 'NP_MYSQL_WITH_SLAVE' => '', | ||
33 | 'NP_MYSQL_WITH_SLAVE_LOGIN' => '', | ||
34 | 'NP_NO_NTP_SERVICE' => 'localhost', | ||
35 | 'NP_SMB_SHARE' => '', | ||
36 | 'NP_SMB_SHARE_DENY' => '', | ||
37 | 'NP_SMB_SHARE_SPC' => '', | ||
38 | 'NP_SMB_VALID_USER' => '', | ||
39 | 'NP_SMB_VALID_USER_PASS' => '', | ||
40 | 'NP_SNMP_COMMUNITY' => '', | ||
41 | 'NP_SSH_CONFIGFILE' => '~/.ssh/config', | ||
42 | 'NP_SSH_HOST' => 'localhost', | ||
43 | 'NP_SSH_IDENTITY' => '~/.ssh/id_dsa', | ||
44 | 'NP_HOST_TCP_JABBER' => 'jabber.org', | ||
45 | 'host_nonresponsive' => '10.0.0.1', | ||
46 | 'host_responsive' => 'localhost', | ||
47 | 'host_snmp' => '', | ||
48 | 'host_tcp_ftp' => '', | ||
49 | 'host_tcp_http' => 'localhost', | ||
50 | 'host_tcp_imap' => 'imap.nierlein.de', | ||
51 | 'host_tcp_smtp' => 'localhost', | ||
52 | 'hostname_invalid' => 'nosuchhost', | ||
53 | 'snmp_community' => '', | ||
54 | 'user_snmp' => '', | ||
55 | 'host_udp_time' => 'none', | ||
56 | } | ||
diff --git a/plugins/t/check_dns.t b/plugins/t/check_dns.t index 2c903db9..b8858807 100644 --- a/plugins/t/check_dns.t +++ b/plugins/t/check_dns.t | |||
@@ -10,7 +10,7 @@ use NPTest; | |||
10 | 10 | ||
11 | plan skip_all => "check_dns not compiled" unless (-x "check_dns"); | 11 | plan skip_all => "check_dns not compiled" unless (-x "check_dns"); |
12 | 12 | ||
13 | plan tests => 13; | 13 | plan tests => 14; |
14 | 14 | ||
15 | my $successOutput = '/DNS OK: [\.0-9]+ seconds? response time/'; | 15 | my $successOutput = '/DNS OK: [\.0-9]+ seconds? response time/'; |
16 | 16 | ||
@@ -54,6 +54,7 @@ cmp_ok( $res->return_code, '==', 2, "Critical threshold passed"); | |||
54 | 54 | ||
55 | $res = NPTest->testCmd("./check_dns -H $hostname_valid -t 5 -w 0 -c 5"); | 55 | $res = NPTest->testCmd("./check_dns -H $hostname_valid -t 5 -w 0 -c 5"); |
56 | cmp_ok( $res->return_code, '==', 1, "Warning threshold passed"); | 56 | cmp_ok( $res->return_code, '==', 1, "Warning threshold passed"); |
57 | like( $res->output, '/\|time=[\d\.]+s;0.0*;5\.0*;0\.0*/', "Output performance data OK" ); | ||
57 | 58 | ||
58 | $res = NPTest->testCmd("./check_dns -H $hostname_invalid -t 1"); | 59 | $res = NPTest->testCmd("./check_dns -H $hostname_invalid -t 1"); |
59 | cmp_ok( $res->return_code, '==', 2, "Invalid $hostname_invalid"); | 60 | cmp_ok( $res->return_code, '==', 2, "Invalid $hostname_invalid"); |
diff --git a/plugins/t/check_fping.t b/plugins/t/check_fping.t index 45a9be8a..08692e46 100644 --- a/plugins/t/check_fping.t +++ b/plugins/t/check_fping.t | |||
@@ -27,16 +27,18 @@ my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_IN | |||
27 | 27 | ||
28 | my $t; | 28 | my $t; |
29 | 29 | ||
30 | if ( -x "./check_fping" ) | 30 | my $fping = qx(which fping 2> /dev/null); |
31 | { | 31 | chomp($fping); |
32 | if( ! -x "./check_fping") { | ||
33 | $t += skipMissingCmd( "./check_fping", $tests ); | ||
34 | } | ||
35 | elsif ( $> != 0 && (!$fping || ! -u $fping)) { | ||
36 | $t += skipMsg( "./check_fping", $tests ); | ||
37 | } else { | ||
32 | $t += checkCmd( "./check_fping $host_responsive", 0, $successOutput ); | 38 | $t += checkCmd( "./check_fping $host_responsive", 0, $successOutput ); |
33 | $t += checkCmd( "./check_fping $host_nonresponsive", [ 1, 2 ] ); | 39 | $t += checkCmd( "./check_fping $host_nonresponsive", [ 1, 2 ] ); |
34 | $t += checkCmd( "./check_fping $hostname_invalid", [ 1, 2 ] ); | 40 | $t += checkCmd( "./check_fping $hostname_invalid", [ 1, 2 ] ); |
35 | } | 41 | } |
36 | else | ||
37 | { | ||
38 | $t += skipMissingCmd( "./check_fping", $tests ); | ||
39 | } | ||
40 | 42 | ||
41 | exit(0) if defined($Test::Harness::VERSION); | 43 | exit(0) if defined($Test::Harness::VERSION); |
42 | exit($tests - $t); | 44 | exit($tests - $t); |
diff --git a/plugins/t/check_hpjd.t b/plugins/t/check_hpjd.t index 10ded54a..4d64852a 100644 --- a/plugins/t/check_hpjd.t +++ b/plugins/t/check_hpjd.t | |||
@@ -10,7 +10,6 @@ use NPTest; | |||
10 | 10 | ||
11 | plan skip_all => "check_hpjd not compiled" unless (-x "check_hpjd"); | 11 | plan skip_all => "check_hpjd not compiled" unless (-x "check_hpjd"); |
12 | 12 | ||
13 | plan tests => 5; | ||
14 | 13 | ||
15 | my $successOutput = '/^Printer ok - /'; | 14 | my $successOutput = '/^Printer ok - /'; |
16 | my $failureOutput = '/Timeout: No [Rr]esponse from /'; | 15 | my $failureOutput = '/Timeout: No [Rr]esponse from /'; |
@@ -20,31 +19,53 @@ my $host_tcp_hpjd = getTestParameter( | |||
20 | "A host (usually a printer) providing the HP-JetDirect Services" | 19 | "A host (usually a printer) providing the HP-JetDirect Services" |
21 | ); | 20 | ); |
22 | 21 | ||
22 | my $host_hpjd_port_invalid = getTestParameter( | ||
23 | "NP_HOST_HPJD_PORT_INVALID", | ||
24 | "A port that HP-JetDirect Services is not listening on", | ||
25 | "162" | ||
26 | ); | ||
27 | |||
28 | my $host_hpjd_port_valid = getTestParameter( | ||
29 | "NP_HOST_HPJD_PORT_VALID", | ||
30 | "The port that HP-JetDirect Services is currently listening on", | ||
31 | "161" | ||
32 | ); | ||
33 | |||
23 | my $host_nonresponsive = getTestParameter( | 34 | my $host_nonresponsive = getTestParameter( |
24 | "NP_HOST_NONRESPONSIVE", | 35 | "NP_HOST_NONRESPONSIVE", |
25 | "The hostname of system not responsive to network requests", | 36 | "The hostname of system not responsive to network requests", |
26 | "10.0.0.1", | 37 | "10.0.0.1" |
27 | ); | 38 | ); |
28 | 39 | ||
29 | my $hostname_invalid = getTestParameter( | 40 | my $hostname_invalid = getTestParameter( |
30 | "NP_HOSTNAME_INVALID", | 41 | "NP_HOSTNAME_INVALID", |
31 | "An invalid (not known to DNS) hostname", | 42 | "An invalid (not known to DNS) hostname", |
32 | "nosuchhost", | 43 | "nosuchhost" |
33 | ); | 44 | ); |
34 | 45 | ||
46 | my $tests = $host_tcp_hpjd ? 9 : 5; | ||
47 | plan tests => $tests; | ||
35 | my $res; | 48 | my $res; |
36 | 49 | ||
37 | SKIP: { | 50 | SKIP: { |
38 | skip "No HP JetDirect defined", 2 unless $host_tcp_hpjd; | 51 | skip "No HP JetDirect defined", 2 unless $host_tcp_hpjd; |
39 | $res = NPTest->testCmd("./check_hpjd $host_tcp_hpjd"); | 52 | $res = NPTest->testCmd("./check_hpjd -H $host_tcp_hpjd"); |
40 | cmp_ok( $res->return_code, '==', 0, "Jetdirect responding" ); | 53 | cmp_ok( $res->return_code, 'eq', 0, "Jetdirect responding" ); |
41 | like ( $res->output, $successOutput, "Output correct" ); | 54 | like ( $res->output, $successOutput, "Output correct" ); |
55 | |||
56 | $res = NPTest->testCmd("./check_hpjd -H $host_tcp_hpjd -p $host_hpjd_port_valid"); | ||
57 | cmp_ok( $res->return_code, 'eq', 0, "Jetdirect responding on port $host_hpjd_port_valid" ); | ||
58 | like ( $res->output, $successOutput, "Output correct" ); | ||
59 | |||
60 | $res = NPTest->testCmd("./check_hpjd -H $host_tcp_hpjd -p $host_hpjd_port_invalid"); | ||
61 | cmp_ok( $res->return_code, 'eq', 2, "Jetdirect not responding on port $host_hpjd_port_invalid" ); | ||
62 | like ( $res->output, $failureOutput, "Output correct" ); | ||
42 | } | 63 | } |
43 | 64 | ||
44 | $res = NPTest->testCmd("./check_hpjd $host_nonresponsive"); | 65 | $res = NPTest->testCmd("./check_hpjd -H $host_nonresponsive"); |
45 | cmp_ok( $res->return_code, 'eq', 2, "Host not responding"); | 66 | cmp_ok( $res->return_code, 'eq', 2, "Host not responding"); |
46 | like ( $res->output, $failureOutput, "Output OK" ); | 67 | like ( $res->output, $failureOutput, "Output OK" ); |
47 | 68 | ||
48 | $res = NPTest->testCmd("./check_hpjd $hostname_invalid"); | 69 | $res = NPTest->testCmd("./check_hpjd -H $hostname_invalid"); |
49 | cmp_ok( $res->return_code, 'eq', 3, "Hostname invalid"); | 70 | cmp_ok( $res->return_code, 'eq', 3, "Hostname invalid"); |
50 | 71 | ||
diff --git a/plugins/t/check_jabber.t b/plugins/t/check_jabber.t index 1aaf8125..7a708d5b 100644 --- a/plugins/t/check_jabber.t +++ b/plugins/t/check_jabber.t | |||
@@ -29,7 +29,7 @@ my $hostname_invalid = getTestParameter( | |||
29 | ); | 29 | ); |
30 | 30 | ||
31 | 31 | ||
32 | my $jabberOK = '/JABBER OK\s-\s\d+\.\d+\ssecond response time on port 5222/'; | 32 | my $jabberOK = '/JABBER OK\s-\s\d+\.\d+\ssecond response time on '.$host_tcp_jabber.' port 5222/'; |
33 | 33 | ||
34 | my $jabberUnresponsive = '/CRITICAL\s-\sSocket timeout after\s\d+\sseconds/'; | 34 | my $jabberUnresponsive = '/CRITICAL\s-\sSocket timeout after\s\d+\sseconds/'; |
35 | 35 | ||
@@ -40,7 +40,7 @@ my $r; | |||
40 | SKIP: { | 40 | SKIP: { |
41 | skip "No jabber server defined", 6 unless $host_tcp_jabber; | 41 | skip "No jabber server defined", 6 unless $host_tcp_jabber; |
42 | 42 | ||
43 | $r = NPTest->testCmd( "./check_jabber $host_tcp_jabber" ); | 43 | $r = NPTest->testCmd( "./check_jabber -H $host_tcp_jabber" ); |
44 | is( $r->return_code, 0, "Connected okay"); | 44 | is( $r->return_code, 0, "Connected okay"); |
45 | like( $r->output, $jabberOK, "Output as expected" ); | 45 | like( $r->output, $jabberOK, "Output as expected" ); |
46 | 46 | ||
@@ -48,7 +48,7 @@ SKIP: { | |||
48 | is( $r->return_code, 0, "Connected okay, within limits" ); | 48 | is( $r->return_code, 0, "Connected okay, within limits" ); |
49 | like( $r->output, $jabberOK, "Output as expected" ); | 49 | like( $r->output, $jabberOK, "Output as expected" ); |
50 | 50 | ||
51 | $r = NPTest->testCmd( "./check_jabber $host_tcp_jabber -wt 9 -ct 9 -to 10" ); | 51 | $r = NPTest->testCmd( "./check_jabber -H $host_tcp_jabber -wt 9 -ct 9 -to 10" ); |
52 | is( $r->return_code, 0, "Old syntax okay" ); | 52 | is( $r->return_code, 0, "Old syntax okay" ); |
53 | like( $r->output, $jabberOK, "Output as expected" ); | 53 | like( $r->output, $jabberOK, "Output as expected" ); |
54 | 54 | ||
diff --git a/plugins/t/check_ntp.t b/plugins/t/check_ntp.t index 3eee6e17..b8fc8fdf 100644 --- a/plugins/t/check_ntp.t +++ b/plugins/t/check_ntp.t | |||
@@ -23,27 +23,27 @@ my $no_ntp_service = getTestParameter( "NP_NO_NTP_SERVICE", | |||
23 | "A host NOT providing the NTP service", | 23 | "A host NOT providing the NTP service", |
24 | "localhost" ); | 24 | "localhost" ); |
25 | 25 | ||
26 | my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE", | 26 | my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE", |
27 | "The hostname of system not responsive to network requests", | 27 | "The hostname of system not responsive to network requests", |
28 | "10.0.0.1" ); | 28 | "10.0.0.1" ); |
29 | 29 | ||
30 | my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID", | 30 | my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID", |
31 | "An invalid (not known to DNS) hostname", | 31 | "An invalid (not known to DNS) hostname", |
32 | "nosuchhost"); | 32 | "nosuchhost"); |
33 | 33 | ||
34 | my $ntp_okmatch1 = '/^NTP\sOK:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs/'; | 34 | my $ntp_okmatch1 = '/^NTP\sOK:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs/'; |
35 | my $ntp_warnmatch1 = '/^NTP\sWARNING:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs/'; | 35 | my $ntp_warnmatch1 = '/^NTP\sWARNING:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs/'; |
36 | my $ntp_critmatch1 = '/^NTP\sCRITICAL:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs/'; | 36 | my $ntp_critmatch1 = '/^NTP\sCRITICAL:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs/'; |
37 | my $ntp_okmatch2 = '/^NTP\sOK:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs,\sjitter=[0-9]+\.[0-9]+,\sstratum=[0-9]{1,2},\struechimers=[0-9]+/'; | 37 | my $ntp_okmatch2 = '/^NTP\sOK:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs,\sjitter=[0-9]+\.[0-9]+,\sstratum=[0-9]{1,2},\struechimers=[0-9]+/'; |
38 | my $ntp_warnmatch2 = '/^NTP\sWARNING:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs,\sjitter=[0-9]+\.[0-9]+,\sstratum=[0-9]{1,2},\struechimers=[0-9]+/'; | 38 | my $ntp_warnmatch2 = '/^NTP\sWARNING:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs,\sjitter=[0-9]+\.[0-9]+,\sstratum=[0-9]{1,2}\s\(WARNING\),\struechimers=[0-9]+/'; |
39 | my $ntp_critmatch2 = '/^NTP\sCRITICAL:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs,\sjitter=[0-9]+\.[0-9]+,\sstratum=[0-9]{1,2},\struechimers=[0-9]+/'; | 39 | my $ntp_critmatch2 = '/^NTP\sCRITICAL:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs,\sjitter=[0-9]+\.[0-9]+\s\(CRITICAL\),\sstratum=[0-9]{1,2},\struechimers=[0-9]+/'; |
40 | my $ntp_noresponse = '/^(CRITICAL - Socket timeout after 3 seconds)|(NTP CRITICAL: No response from NTP server)$/'; | 40 | my $ntp_noresponse = '/^(CRITICAL - Socket timeout after 3 seconds)|(NTP CRITICAL: No response from NTP server)$/'; |
41 | my $ntp_nosuchhost = '/^check_ntp.*: Invalid hostname/address - ' . $hostname_invalid . '/'; | 41 | my $ntp_nosuchhost = '/^check_ntp.*: Invalid hostname/address - ' . $hostname_invalid . '/'; |
42 | 42 | ||
43 | 43 | ||
44 | foreach my $plugin (@PLUGINS1) { | 44 | foreach my $plugin (@PLUGINS1) { |
45 | SKIP: { | 45 | SKIP: { |
46 | skip "No NTP server defined", 1 unless $ntp_service; | 46 | skip "No NTP server defined", 6 unless $ntp_service; |
47 | $res = NPTest->testCmd( | 47 | $res = NPTest->testCmd( |
48 | "./$plugin -H $ntp_service -w 1000 -c 2000" | 48 | "./$plugin -H $ntp_service -w 1000 -c 2000" |
49 | ); | 49 | ); |
@@ -88,7 +88,7 @@ foreach my $plugin (@PLUGINS1) { | |||
88 | 88 | ||
89 | foreach my $plugin (@PLUGINS2) { | 89 | foreach my $plugin (@PLUGINS2) { |
90 | SKIP: { | 90 | SKIP: { |
91 | skip "No NTP server defined", 1 unless $ntp_service; | 91 | skip "No NTP server defined", 6 unless $ntp_service; |
92 | $res = NPTest->testCmd( | 92 | $res = NPTest->testCmd( |
93 | "./$plugin -H $ntp_service -w 1000 -c 2000 -W 20 -C 21 -j 100000 -k 200000 -m 1: -n 0:" | 93 | "./$plugin -H $ntp_service -w 1000 -c 2000 -W 20 -C 21 -j 100000 -k 200000 -m 1: -n 0:" |
94 | ); | 94 | ); |
diff --git a/plugins/t/check_procs.t b/plugins/t/check_procs.t index ca4acdd7..abe7284e 100644 --- a/plugins/t/check_procs.t +++ b/plugins/t/check_procs.t | |||
@@ -26,7 +26,7 @@ $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" ); |
27 | like( $result->output, '/^PROCS OK: [0-9]+ process(es)? with /', "Output correct" ); | 27 | like( $result->output, '/^PROCS OK: [0-9]+ process(es)? with /', "Output correct" ); |
28 | 28 | ||
29 | if(fork() == 0) { exec("sleep 7"); } # fork a test process | 29 | if(fork() == 0) { exec("sleep 7"); } else { sleep(1) } # fork a test process in child and give child time to fork in parent |
30 | $result = NPTest->testCmd( "./check_procs -a 'sleep 7'" ); | 30 | $result = NPTest->testCmd( "./check_procs -a 'sleep 7'" ); |
31 | is( $result->return_code, 0, "Parent process is ignored" ); | 31 | is( $result->return_code, 0, "Parent process is ignored" ); |
32 | like( $result->output, '/^PROCS OK: 1 process?/', "Output correct" ); | 32 | like( $result->output, '/^PROCS OK: 1 process?/', "Output correct" ); |
diff --git a/plugins/t/check_snmp.t b/plugins/t/check_snmp.t index c35d7821..2d6c44a7 100644 --- a/plugins/t/check_snmp.t +++ b/plugins/t/check_snmp.t | |||
@@ -45,7 +45,7 @@ is( $res->return_code, 3, "Invalid protocol" ); | |||
45 | like( $res->output, "/check_snmp: Invalid SNMP version - 3c/" ); | 45 | like( $res->output, "/check_snmp: Invalid SNMP version - 3c/" ); |
46 | 46 | ||
47 | SKIP: { | 47 | SKIP: { |
48 | skip "no snmp host defined", 38 if ( ! $host_snmp ); | 48 | skip "no snmp host defined", 48 if ( ! $host_snmp ); |
49 | 49 | ||
50 | $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:"); | 50 | $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:"); |
51 | cmp_ok( $res->return_code, '==', 0, "Exit OK when querying uptime" ); | 51 | cmp_ok( $res->return_code, '==', 0, "Exit OK when querying uptime" ); |
diff --git a/plugins/t/check_udp.t b/plugins/t/check_udp.t index 619cadfb..1f6fee70 100644 --- a/plugins/t/check_udp.t +++ b/plugins/t/check_udp.t | |||
@@ -62,7 +62,7 @@ SKIP: { | |||
62 | cmp_ok( $res->return_code, '==', '2', "Hung waiting for response"); | 62 | cmp_ok( $res->return_code, '==', '2', "Hung waiting for response"); |
63 | like ( $res->output, '/Socket timeout after 5 seconds/', "Timeout message"); | 63 | like ( $res->output, '/Socket timeout after 5 seconds/', "Timeout message"); |
64 | like ( $duration, '/^[56]$/', "Timeout after 5 (possibly 6) seconds"); | 64 | like ( $duration, '/^[56]$/', "Timeout after 5 (possibly 6) seconds"); |
65 | my $read_nc = <NC>; | 65 | my $read_nc = <NC> || ''; |
66 | close NC; | 66 | close NC; |
67 | cmp_ok( $read_nc, 'eq', "foofoo", "Data received correctly" ); | 67 | cmp_ok( $read_nc, 'eq', "foofoo", "Data received correctly" ); |
68 | } | 68 | } |