Module: monitoring-plugins
    Branch: master
    Commit: 4231415878daedefd707a39e54f7b438238908d6
    Author: Davide Madrisan <[email protected]>
 Committer: Jan Wagner <[email protected]>
      Date: Thu Feb 20 13:12:26 2014 +0100
       URL: 
https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=4231415

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 <[email protected]>

---

 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 2714961..0b87d68 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);
        }

Reply via email to