Table of Contents


check_tcp_connect - nagios plugin for checking tcp connects


check_tcp_connect -I ip-address -w warnlevel -c critlevel [ -p port ] [ -P resultprefix ] [ -t timeout ] [ -T(O|W|C) ] [ -D ]


check_tcp_connect is a nagios plugin for checking TCP ports. It tries to connect to the given port and measures the time to connect.


-I ip-address
Specify the IP address of the remote server to check.

-w warnlevel
Specify the warning level (connect time in ms).

-c critlevel
Specify the critical level (connect time in ms).

-p port
Specify the port to connect to on the remote host (default: 80).

-P resultprefix
Specify prefix of the result string (default: "TCP")

-t timeout
The plugins internal timeout in seconds (default: 10).

On timeout return OK instead of UNKNOWN.

On timeout return WARNING instead of UNKNOWN.

On timeout return CRITICAL instead of UNKNOWN.

Use TCP_DEFER_ACCEPT (see tcp(7) ). This can speed up our http-communication by approx. 10 percent, but it breaks tcp-communication by RFC - like many others too. It can also cause trouble with loadbalancers like F5 which send "early" ACK packets to the server before ACK from client.


check_tcp_connect does not use any files, a sample nagios config is shown here:

define service{
use service_port

name http

check_command check_tcp_connect!500!5000!70

register 0

define command{
command_name check_tcp_connect
command_line $USER1$/check_tcp_connect -I $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p $ARG3$

See Also


A sample host-alive-check:

$ check_tcp_connect -I -w 1000 -c 5000 -p 22 -P "TCP Port 22"
TCP Port 22 OK - 0.000 second response time |time=0.000533s


Frank Bergmann,

Table of Contents