TCP port monitoring
The simplest availability check for a service: a connection to the host and port either opens or it does not. Use it wherever there is no website to send an HTTP request to.
Upstat attempts a TCP connection to the host and port you set. If the connection opens, the monitor is fine. If the port does not answer within the configured timeout_ms, the monitor is DOWN.
What is checked
- The checker tries to open a TCP connection to the host and port.
- If the connection is established, the check passed and the time it took is measured.
- After the connection is made nothing is sent or read. The check confirms that the port is listening, not that the service behind it answers correctly.
What counts as a failure
- The connection is refused because nothing listens on the port.
- The host name cannot be resolved through DNS.
- The connection is not established within the timeout, for example because of a firewall.
Monitor settings
The checker really reads all of this from the monitor configuration.
-
Host
host -
A domain name or the IP address of the server.
Where to set it: Dashboard and REST API
-
Port
port -
A port number from 1 to 65535, for example 22 for SSH or 25 for SMTP.
Where to set it: Dashboard and REST API
-
Timeout
timeout_ms -
The longest time in milliseconds the checker waits for the connection. Without a value the checker default applies.
Where to set it: Dashboard and REST API
Example through the REST API
A monitor that checks every 5 minutes whether port 25 on a mail server is listening. The interval cannot be shorter than your plan minimum.
Port monitor configuration
{
"name": "SMTP mail.example.com",
"type": "port",
"interval_seconds": 300,
"config": {
"host": "mail.example.com",
"port": 25,
"timeout_ms": 5000
}
}
What happens on failure
- The monitor changes from UP to DOWN. If you use ignore blips, the failure first has to last for the time or the number of checks you set.
- An incident named after the monitor is created automatically. When a check passes again, the incident closes itself.
- Your alert rules send a message through the channels you set up: Slack, Discord, Telegram, email, SMS, push, webhook or ntfy.
- If the monitor is linked to a status page component, its state shows up there too.
How it works with ignore blips
A short outage does not have to mean DOWN right away. For each monitor you can set state stabilization. Upstat decides it when it processes check results, not the checker.
consecutive_failures- How many checks in a row must fail before the monitor is marked DOWN. For example 3 means three failures in a row.
min_down_seconds- How long the failing has to last before the state changes to DOWN.
min_up_seconds- How long everything has to be fine after an outage before the monitor goes back to UP. It protects against rapid flapping.
A port that closes for a few seconds while a service restarts is a typical blip. Requiring several failures in a row avoids an alert for every planned restart.
Limits by plan
The shortest allowed interval between checks depends on the plan. The numbers are read straight from the plan settings.
| Plan | Shortest check interval |
|---|---|
| Hobby | 120 s |
| Starter | 60 s |
| Pro | 30 s |
Questions about this type
- Does a port monitor also verify that a database or mail server answers correctly?
- No. Only the TCP connection is checked. The answer of the application is not judged.