> ## 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 Monitors

> Monitor port connectivity and service availability with DevHelm TCP monitors

TCP monitors verify that a host is accepting connections on a specific port. Use them for databases, message queues, mail servers, and any service that listens on a TCP port but doesn't speak HTTP.

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

## When to use TCP monitors

* **Database connectivity** — verify PostgreSQL (5432), MySQL (3306), or Redis (6379) is accepting connections
* **Message queue health** — check RabbitMQ, NATS, or Kafka broker ports
* **Mail servers** — verify SMTP (25/587) or IMAP (993) ports are open
* **Custom services** — any non-HTTP service that accepts TCP connections

## How it works

1. DevHelm opens a TCP connection to the specified host and port from each probe region
2. If the connection succeeds within the timeout, the check passes
3. Response time is measured from connection initiation to completion
4. Assertions evaluate the connection result

## Quick example

<CodeGroup>
  ```bash CLI theme={null}
  devhelm monitors create \
    --name "PostgreSQL" \
    --type TCP \
    --url db.example.com \
    --port 5432 \
    --frequency 60 \
    --regions us-east,eu-west
  ```

  ```yaml devhelm.yml theme={null}
  monitors:
    - name: PostgreSQL
      type: TCP
      config:
        host: db.example.com
        port: 5432
      frequencySeconds: 60
      regions: [us-east, eu-west]
      assertions:
        - type: tcp_connects
          severity: fail
        - type: tcp_response_time
          maxMs: 500
          severity: fail
  ```
</CodeGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Configuration" icon="gear" href="/monitoring/tcp/configuration">
    Host, port, timeout, and assertion fields.
  </Card>

  <Card title="Monitoring overview" icon="signal" href="/monitoring/overview">
    Compare all six monitor types.
  </Card>
</CardGroup>
