Forum Discussion

Joe_Tran's avatar
Icon for Advisor rankAdvisor
6 years ago

Collector Debug - TCP/Telnet command

I would like to see a !tcp <host> <port> OR a !telnet <host> <port> like command in the Collector Debug utility. It should return back the connection status and response time. 

8 Replies

Replies have been turned off for this discussion
  • A workaround using the !groovy command:

    def sout = new StringBuilder();
    def serr = new StringBuilder();

    // Shell command for your OS
    def proc = 'cmd.exe /c tracert'.execute();

    proc.consumeProcessOutput(sout, serr);

    // Adjust timeout as needed
    proc.waitForOrKill(20 * 1000);

    println "out> $sout err> $serr"

  • Since we're posting !groovy workarounds---here is one I'm using for telnet: 

    hostname = 'internal.server.local'
    port = 22
    try {
        s = new Socket(hostname, port)
        println "Connected to $hostname on port $port"
    } catch (ConnectException ce) {
        println ce.toString()
    } catch (BindException be) {
        println be.toString()
    } catch (NoRouteToHostException re) {
        println re.toString()
    } catch (PortUnreachableException pe) {
        println pe.toString()
    } catch (Exception e) {
        println e.toString()


  • On 22/08/2018 at 9:31 PM, Joe Williams said:

    To tag on !traceroute or !tracert would be a nice addition as well.


    @Joe Williams there is a traceroute ConfigSource, if you have LM Config:


    It's not a debug command (obviously!) but you can lift the groovy out of it and use it via the debug window and the !groovy command as a workaround in the meantime.

  • @Mosh it's not a core ConfigSource, just something I threw together on the side. Follow the link above to the thread and you'll find the locator ID which you can use to get the ConfigSource from the Exchange.