Monitoring as Code: Learn more about the TCP Monitor Construct.
What are TCP Monitors?
TCP monitors perform low-level connectivity checks by establishing TCP connections to your services. They verify that your services are listening on the expected ports and can accept connections, making them essential for monitoring infrastructure components and backend services.
- Database servers (MySQL, PostgreSQL, MongoDB)
- Mail servers (SMTP, IMAP, POP3)
- Custom TCP services and APIs
- Load balancers and proxies
- SSH and FTP servers
- Redis and Memcached instances
How TCP Monitoring Works
TCP monitors perform connection-level checks:- Connection Attempt - Establishes a TCP connection to your service
- Port Verification - Confirms the service is listening on the specified port
- Response Validation - Optionally validates service responses
- SSL/TLS Check - Verifies certificate validity for secure connections
- Timing Measurement - Records connection and response times
TCP monitors are ideal for monitoring services that don’t expose HTTP endpoints but need connectivity verification.
SSL/TLS Certificate Monitoring
For services using SSL/TLS, TCP monitors automatically check:- Certificate Validity: Ensures certificates are not expired
- Chain Validation: Verifies the complete certificate chain
- Expiration Warnings: Alerts before certificates expire
- Protocol Compliance: Checks for secure protocol versions
Certificate monitoring is only available when using SSL/TLS protocol options.
Troubleshooting Common Issues
Connection Refused
Connection Refused
Symptom: Monitor shows “Connection refused” errors
Causes:
- Service is not running
- Port is blocked by firewall
- Incorrect host/port configuration
- Verify service is running:
netstat -tlnp | grep :3306
- Check firewall rules
- Test connectivity:
telnet hostname port
Timeout Errors
Timeout Errors
Symptom: Monitor times out without connecting
Causes:
- Network latency or packet loss
- Service overloaded
- Timeout set too low
- Increase connection timeout
- Check network connectivity
- Monitor service performance
SSL Certificate Issues
SSL Certificate Issues
Symptom: SSL validation failures
Causes:
- Certificate expired
- Hostname mismatch
- Invalid certificate chain
- Check certificate validity:
openssl s_client -connect hostname:port
- Verify certificate expiration dates
- Update certificates before expiration