summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Wagner <waja@cyconet.org>2014-06-30 13:02:38 (GMT)
committerJan Wagner <waja@cyconet.org>2014-06-30 13:13:39 (GMT)
commitb62f2c14fbcec04c021774a9fe0275e395d9eecc (patch)
tree24233f99298d32314602a1283dcecbcf9ce35a58
parented914472e92157ef8a304d8c2916058f24c7c964 (diff)
parent4277f47bffb65bafeb9b8e256dd7116ce747e850 (diff)
downloadmonitoring-plugins-b62f2c14fbcec04c021774a9fe0275e395d9eecc.tar.gz
Merge PR #1265 from waja/check_tcp_server_addr
-rw-r--r--plugins/check_tcp.c9
-rw-r--r--plugins/t/check_jabber.t6
2 files changed, 10 insertions, 5 deletions
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index ebdccd1..bd7736b 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -353,8 +353,13 @@ main (int argc, char **argv)
353 printf("Unexpected response from host/socket on "); 353 printf("Unexpected response from host/socket on ");
354 else 354 else
355 printf("%.3f second response time on ", elapsed_time); 355 printf("%.3f second response time on ", elapsed_time);
356 if(server_address[0] != '/') 356 if(server_address[0] != '/') {
357 printf("port %d", server_port); 357 if (host_specified)
358 printf("%s port %d",
359 server_address, server_port);
360 else
361 printf("port %d", server_port);
362 }
358 else 363 else
359 printf("socket %s", server_address); 364 printf("socket %s", server_address);
360 } 365 }
diff --git a/plugins/t/check_jabber.t b/plugins/t/check_jabber.t
index 1aaf812..7a708d5 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
32my $jabberOK = '/JABBER OK\s-\s\d+\.\d+\ssecond response time on port 5222/'; 32my $jabberOK = '/JABBER OK\s-\s\d+\.\d+\ssecond response time on '.$host_tcp_jabber.' port 5222/';
33 33
34my $jabberUnresponsive = '/CRITICAL\s-\sSocket timeout after\s\d+\sseconds/'; 34my $jabberUnresponsive = '/CRITICAL\s-\sSocket timeout after\s\d+\sseconds/';
35 35
@@ -40,7 +40,7 @@ my $r;
40SKIP: { 40SKIP: {
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