Page 1 of 1

check_tcp - how to check for immediately closed connection

Posted: Tue May 05, 2015 11:46 am
by naguser
I'm trying to test a telnet connection with check_tcp. When the end-service is not working, it still accepts connections, but closes them immediately. So check_tcp always passes.

Is there anyway to make check_tcp require a few seconds of open connection? I tried using delay parameter - no good. I tried sending commands and using expected text, but I'm not familiar with what commands to send and via a manual test connection, it doesn't really respond to anything.

Thanks.

Re: check_tcp - how to check for immediately closed connecti

Posted: Tue May 05, 2015 1:53 pm
by jdalrymple
What does the TCP connection do? Generally you can use --send and expect some sort of reply. If your device is closing the connection you won't get that reply and that would be where you'd error out.

Re: check_tcp - how to check for immediately closed connecti

Posted: Tue May 05, 2015 1:55 pm
by ssax

Code: Select all

-m, --maxbytes=INTEGER
    Close connection once more than this number of bytes are received
OR

Code: Select all

-e, --expect=STRING
    String to expect in server response (may be repeated)
I can't replicate your setup so you'll have to test it, I don't think there is any other way to do it without you modifying the code and recompiling or writing your own script.