---
title: TCP Check
description: Monitor TCP connectivity to remote hosts.
breadcrumbs: Docs > Integrations > TCP Check
---

# TCP Check
Supported OS Integration version6.3.0


## Overview{% #overview %}

Monitor TCP connectivity and response time for any host and port.

**Minimum Agent version:** 6.0.0

## Setup{% #setup %}

### Installation{% #installation %}

The TCP check is included in the [Datadog Agent](https://app.datadoghq.com/account/settings/agent/latest) package. No additional installation is needed on your server.

Many metrics checks are best run on the same host(s) as the monitored service. However, it's recommended to run this check from hosts that do not run the monitored TCP services to test remote connectivity.

### Configuration{% #configuration %}

{% tab title="Host" %}
#### Host{% #host %}

To configure this check for an Agent running on a host:

Edit the `tcp_check.d/conf.yaml` file in the `conf.d/` folder at the root of your [Agent's configuration directory](https://docs.datadoghq.com/agent/guide/agent-configuration-files/#agent-configuration-directory). See the [sample tcp_check.d/conf.yaml](https://github.com/DataDog/integrations-core/blob/master/tcp_check/datadog_checks/tcp_check/data/conf.yaml.example) for all available configuration options:

```yaml
init_config:

instances:
  - name: SSH check
    host: jumphost.example.com # or an IPv4/IPv6 address
    port: 22
    collect_response_time: true # to collect network.tcp.response_time. Default is false.
```

Configuration Options:

- `name` (Required) - Name of the service. This is included as a tag: `instance:<name>`. **Note**: Any spaces or dashes are converted to underscores.
- `host` (Required) - Host to be checked. This is included as a tag: `url:<host>:<port>`.
- `port` (Required) - Port to be checked. This is included as a tag: `url:<host>:<port>`.
- `timeout` (Optional) - Timeout for the check. Defaults to 10 seconds.
- `collect_response_time` (Optional) - Defaults to false, which means no response time metric is collected. If set to true, the metric returned is `network.tcp.response_time`.
- `tags` (Optional) - Tags to be assigned to the metric.

[Restart the Agent](https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent) to start sending TCP service checks and response times to Datadog.
{% /tab %}

{% tab title="Containerized" %}
#### Containerized{% #containerized %}

For containerized environments, see the [Autodiscovery Integration Templates](https://docs.datadoghq.com/agent/kubernetes/integrations/) for guidance on applying the parameters below.

| Parameter            | Value                                                                         |
| -------------------- | ----------------------------------------------------------------------------- |
| `<INTEGRATION_NAME>` | `tcp_check`                                                                   |
| `<INIT_CONFIG>`      | blank or `{}`                                                                 |
| `<INSTANCE_CONFIG>`  | `{"name": "<TCP_CHECK_INSTANCE_NAME>", "host":"%%host%%", "port":"%%port%%"}` |

{% /tab %}

### Validation{% #validation %}

[Run the Agent's `status` subcommand](https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information) and look for `tcp_check` under the Checks section.

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **network.tcp.response\_time**(gauge) | The response time of a given host and TCP port, tagged with url, e.g. 'url:192.168.1.100:22'.*Shown as second* |
| **network.tcp.can\_connect**(gauge)   | Value of 1 if the agent can successfully establish a connection to the URL, 0 otherwise                        |

### Events{% #events %}

The TCP check does not include any events.

### Service Checks{% #service-checks %}

**tcp.can\_connect**

Returns CRITICAL if the Agent cannot establish an TCP connection to the URL. Returns OK if the connection is successful.

*Statuses: ok, critical*

**Note:** To set an alert on this service check, create a [Network Monitor](https://docs.datadoghq.com/monitors/monitor_types/network/?tab=checkalert).

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).
