From 4231415878daedefd707a39e54f7b438238908d6 Mon Sep 17 00:00:00 2001 From: Davide Madrisan Date: Thu, 20 Feb 2014 13:12:26 +0100 Subject: check_tcp: also display the server addr when host_specified is set. This will help the admins when multiple checks are configured Signed-off-by: Davide Madrisan --- plugins/check_tcp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 2714961f..0b87d687 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c @@ -354,8 +354,13 @@ main (int argc, char **argv) printf("Unexpected response from host/socket on "); else printf("%.3f second response time on ", elapsed_time); - if(server_address[0] != '/') - printf("port %d", server_port); + if(server_address[0] != '/') { + if (host_specified) + printf("host %s and port %d", + server_address, server_port); + else + printf("port %d", server_port); + } else printf("socket %s", server_address); } -- cgit v1.2.3-74-g34f1 From b5d78f9556f6da877afaa763f281e7495d572367 Mon Sep 17 00:00:00 2001 From: abrist Date: Thu, 20 Feb 2014 16:02:36 -0500 Subject: Cleaned up status output of check_tcp changes --- plugins/check_tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 0b87d687..b0459f2b 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c @@ -356,7 +356,7 @@ main (int argc, char **argv) printf("%.3f second response time on ", elapsed_time); if(server_address[0] != '/') { if (host_specified) - printf("host %s and port %d", + printf("%s port %d", server_address, server_port); else printf("port %d", server_port); -- cgit v1.2.3-74-g34f1 From 4277f47bffb65bafeb9b8e256dd7116ce747e850 Mon Sep 17 00:00:00 2001 From: abrist Date: Mon, 3 Mar 2014 12:42:33 -0500 Subject: check_jabber.t - fixed tests for new status output including hostname --- plugins/t/check_jabber.t | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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( ); -my $jabberOK = '/JABBER OK\s-\s\d+\.\d+\ssecond response time on port 5222/'; +my $jabberOK = '/JABBER OK\s-\s\d+\.\d+\ssecond response time on '.$host_tcp_jabber.' port 5222/'; my $jabberUnresponsive = '/CRITICAL\s-\sSocket timeout after\s\d+\sseconds/'; @@ -40,7 +40,7 @@ my $r; SKIP: { skip "No jabber server defined", 6 unless $host_tcp_jabber; - $r = NPTest->testCmd( "./check_jabber $host_tcp_jabber" ); + $r = NPTest->testCmd( "./check_jabber -H $host_tcp_jabber" ); is( $r->return_code, 0, "Connected okay"); like( $r->output, $jabberOK, "Output as expected" ); @@ -48,7 +48,7 @@ SKIP: { is( $r->return_code, 0, "Connected okay, within limits" ); like( $r->output, $jabberOK, "Output as expected" ); - $r = NPTest->testCmd( "./check_jabber $host_tcp_jabber -wt 9 -ct 9 -to 10" ); + $r = NPTest->testCmd( "./check_jabber -H $host_tcp_jabber -wt 9 -ct 9 -to 10" ); is( $r->return_code, 0, "Old syntax okay" ); like( $r->output, $jabberOK, "Output as expected" ); -- cgit v1.2.3-74-g34f1