> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devhelm.io/llms.txt
> Use this file to discover all available pages before exploring further.

# TCP Monitor Configuration

> Configure DevHelm TCP monitors — host, port, timeout, and connection assertions

TCP monitors require a host and port. Additional options control timeout behavior and response time thresholds.

<Tip>
  **Define this in code.** [YAML format](/mac/yaml/monitors) · [Terraform](/mac/terraform/monitors)
</Tip>

## Config fields

| Field              | Type    | Required | Default | Description                        |
| ------------------ | ------- | -------- | ------- | ---------------------------------- |
| `config.host`      | string  | Yes      | —       | Hostname or IP address             |
| `config.port`      | integer | Yes      | —       | TCP port (1–65535)                 |
| `config.timeoutMs` | integer | No       | `10000` | Connection timeout in milliseconds |

## Assertions

| Assertion                | Fields             | Description                                          |
| ------------------------ | ------------------ | ---------------------------------------------------- |
| `tcp_connects`           | *(none)*           | Passes if a TCP connection is established            |
| `tcp_response_time`      | `maxMs` (integer)  | Fails if connection time exceeds threshold           |
| `tcp_response_time_warn` | `warnMs` (integer) | Records degraded hint if connection time is elevated |

## Examples

### Basic port check

```yaml theme={null}
monitors:
  - name: Redis
    type: TCP
    config:
      host: redis.example.com
      port: 6379
    frequencySeconds: 60
    regions: [us-east]
    assertions:
      - config:
          type: tcp_connects
        severity: fail
```

### With response time threshold

```yaml theme={null}
monitors:
  - name: PostgreSQL
    type: TCP
    config:
      host: db.example.com
      port: 5432
      timeoutMs: 5000
    frequencySeconds: 60
    regions: [us-east, eu-west]
    assertions:
      - config:
          type: tcp_connects
        severity: fail
      - config:
          type: tcp_response_time
          maxMs: 500
        severity: fail
      - config:
          type: tcp_response_time_warn
          warnMs: 200
        severity: warn
```

## Next steps

<CardGroup cols={2}>
  <Card title="TCP overview" icon="plug" href="/monitoring/tcp/overview">
    When to use TCP monitors.
  </Card>

  <Card title="Regions" icon="earth-americas" href="/monitoring/regions">
    Available probe regions.
  </Card>
</CardGroup>
