upti.my

TCP Health Checks

Monitor any TCP service by verifying that a port is open and accepting connections.

Overview

TCP health checks are a fundamental monitoring type that verifies whether a service is listening on a specific port and accepting connections. This is the ideal check type for databases, message brokers, cache servers, mail servers, and any other TCP-based service that does not use HTTP.

The check establishes a TCP connection to the specified host and port. If the connection succeeds, the service is considered healthy. Optionally, you can also verify a banner message that the service sends upon connection.

Configuration

ParameterDescriptionDefault
HostThe hostname or IP address of the service to checkRequired
PortThe TCP port number to connect toRequired
Expected Banner PrefixA string prefix that the service's banner message should start withEmpty (connection-only check)

How It Works

When a TCP health check runs, upti.my performs the following steps:

  1. Resolves the hostname to an IP address (if a domain is provided)
  2. Initiates a TCP connection to the resolved IP and specified port
  3. If an expected banner prefix is configured, reads the initial data sent by the server
  4. Compares the received banner against the expected prefix
  5. Closes the connection and records the results

Banner Checking

Many TCP services send a banner or greeting message when a client connects. For example, an SMTP server might send 220 mail.example.com ESMTP, and a Redis server might respond with version information. Banner checking lets you verify not just that a port is open, but that the correct service is running behind it.

💡 Common Banners

Here are banner prefixes for popular services:

SMTP: 220, FTP: 220, SSH: SSH-2.0, MySQL: a binary protocol handshake, PostgreSQL: no banner (use connection-only mode), Redis: no banner by default.

Response Data

Each TCP health check execution captures the following data:

FieldDescription
Banner TextThe banner or greeting message received from the server (if any)
TCP Connection TimeTime taken to establish the TCP connection in milliseconds
Banner Read TimeTime taken to receive the banner message from the server

Common Use Cases

  • Databases - Monitor PostgreSQL (5432), MySQL (3306), MongoDB (27017), Redis (6379)
  • Message Brokers - Check RabbitMQ (5672), Kafka (9092), NATS (4222)
  • Mail Servers - Verify SMTP (25/587), IMAP (143/993), POP3 (110/995)
  • Custom Services - Monitor any internal service listening on a TCP port
  • SSH - Verify SSH servers are accessible on port 22

Example Configuration

TCP Check - PostgreSQL
{
  "host": "db.example.com",
  "port": 5432,
  "expected_banner_prefix": "",
  "timeout_seconds": 5,
  "interval_seconds": 60
}
TCP Check - SMTP with Banner
{
  "host": "mail.example.com",
  "port": 25,
  "expected_banner_prefix": "220",
  "timeout_seconds": 10,
  "interval_seconds": 60
}

ℹ️ When to Use TCP vs. HTTP

Use TCP checks for non-HTTP services or when you only need to verify that a port is open. If your service speaks HTTP, prefer an HTTP health check, which provides richer response validation and performance metrics.

⚠️ Firewall Considerations

Make sure the target port is accessible from upti.my's monitoring nodes. Firewalls, security groups, or network policies may block incoming connections. For internal services, consider deploying an upti.my agent within your network.