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

# Port (TCP) Monitoring

> Check that a TCP port accepts connections, with optional protocol banner checks for mail and FTP servers

A port monitor opens a TCP connection to a host and port and succeeds when the connection is accepted. For some protocols it can also check the server's greeting banner or a response.

## When to use it

* Databases: MySQL (3306), PostgreSQL (5432), MongoDB (27017), Redis (6379)
* Mail servers: SMTP (25, 465, 587), POP3 (110, 995), IMAP (143, 993)
* SSH (22), FTP (21) and custom TCP services

To check a web page or HTTP endpoint, use an [HTTP monitor](/monitors/http). Port monitors do not offer HTTP or HTTPS protocols.

<Note>
  Port checks run from UptimeIO's probe locations over the public internet, so the target must be publicly reachable. Private and internal targets (private IP ranges such as 10.x, 172.16-31.x and 192.168.x, `localhost`, and names ending in `.local`, `.internal` or `.lan`) are not accepted. Allow the connection through your firewall or security group.
</Note>

## Create a port monitor

<Steps>
  <Step title="Enter the host">
    Enter the **Hostname or IP Address**, a public hostname or IP such as `db.yourcompany.com`. The port is set separately in **Port Configuration**.
  </Step>

  <Step title="Choose a protocol and port">
    In **Port Configuration**, pick the **Protocol Type** and enter the **Port Number**. The protocol decides which optional checks are available.
  </Step>

  <Step title="Set interval and locations">
    In **How often we check**, choose the **Check Interval**. The shortest interval depends on your plan: 5 minutes on Free, 1 minute on Pro and Scale. Pro and Scale can choose probe locations; Free uses automatic selection.
  </Step>
</Steps>

### Settings

| Setting | What it does | Default / options |
| - | - | - |
| **Monitor Name** | Name shown in your dashboard | Generated from the host, up to 80 characters |
| **Hostname or IP Address** | The server to connect to | Required |
| **Protocol Type** | The service you expect on the port | SMTP (Email), POP3 (Email), IMAP (Email), FTP (File Transfer), SSH (Secure Shell), Generic TCP |
| **Port Number** | TCP port to connect to, 1 to 65535. Choosing a protocol suggests its standard port | Required |
| **Connection Timeout** | Longest wait for the connection, 5 to 60 seconds. Must be shorter than the check interval | 10 seconds |
| **Check protocol banner/greeting** | Verify the server answers with the expected greeting. Only for SMTP, POP3, IMAP and FTP | Off |
| **Check Interval** | Time between checks | 1 minute to 24 hours. Plan minimum applies |

### Protocols

| Protocol | Standard port | Optional check |
| - | - | - |
| Generic TCP | none | None. Connection test only. |
| SSH | 22 | None. Connection test only (the SSH banner is not checked). |
| SMTP | 25 | **Check protocol banner/greeting**: expects a greeting containing `220`. |
| POP3 | 110 | Banner check: expects `+OK`. |
| IMAP | 143 | Banner check: expects `* OK`. |
| FTP | 21 | Banner check: expects `220`. |

<Info>
  Port monitors only open a TCP connection and read a greeting; they never send an HTTP request or negotiate TLS. To check a web page use an [HTTP monitor](/monitors/http). A port monitor created earlier with HTTP or HTTPS keeps running as before; when you edit and save it, it becomes a connection test.
</Info>

### Example: connection test

* **Hostname or IP Address**: `db.yourcompany.com`
* **Protocol Type**: Generic TCP
* **Port Number**: `5432`
* **Check Interval**: 5 minutes

### Example: SMTP banner check

* **Hostname or IP Address**: `mail.yourcompany.com`
* **Protocol Type**: SMTP (Email)
* **Port Number**: `25`
* **Check protocol banner/greeting**: on

## How a check decides

* **Banner check off**: succeeds as soon as the TCP connection is established.
* **Banner check on**: succeeds when the server's greeting contains the expected text, and fails otherwise.

## Common ports

| Service | Port | Service | Port |
| - | - | - | - |
| MySQL | 3306 | SMTP | 25 / 587 / 465 |
| PostgreSQL | 5432 | POP3 | 110 / 995 |
| MongoDB | 27017 | IMAP | 143 / 993 |
| Redis | 6379 | SSH / SFTP | 22 |
| SQL Server | 1433 | FTP | 21 |

## Best practices

* Use a banner check for mail and FTP servers: an open port does not prove the service answers correctly.
* Keep the timeout around 5-10 seconds.
* Combine with [Ping](/monitors/ping) (is the host up?) and [HTTP](/monitors/http) (does the application work?).
* A port monitor proves connectivity only. The service can accept connections while authentication is broken.
* Do not expose databases to the whole internet just to monitor them. Restrict access with a firewall where you can.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Connection refused">
    Nothing is listening on that port, the port is wrong, or the service only listens on localhost. Check with `nc -zv hostname port` and the service's bind address.
  </Accordion>

  <Accordion title="Connection timeout">
    A firewall is dropping the traffic, the host is unreachable, or the **Connection Timeout** is too low. Allow the connection and check firewall logs.
  </Accordion>

  <Accordion title="Banner check fails">
    The server's greeting did not contain the expected text. The port may be served by a different service or a proxy. Check the banner manually with `nc hostname port`.
  </Accordion>

  <Accordion title="Target not accepted">
    The target is private, internal, a test domain or one of UptimeIO's own domains. Use a public hostname or IP.
  </Accordion>
</AccordionGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="HTTP Monitoring" icon="globe" href="/monitors/http">
    Monitor web services and APIs
  </Card>

  <Card title="Notifications" icon="bell" href="/notifications/overview">
    Configure alerts for port monitors
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.