Server uptime monitoring without an agent

How to monitor a server's uptime from outside: ping for the host, TCP checks for each service, HTTP for web apps, and a heartbeat for what only the server can see.

· 5 min read · By the Spot Downtime team

“Is the server up?” is really several questions: does the machine answer, is each service on it accepting connections, does the app behind them work, and are its jobs still running? You can answer all four from outside, with nothing installed on the server, by stacking a few simple checks.

Want CPU, memory and disk too?

This guide needs nothing on the server. To also see what's happening inside it, and get alerted before a disk fills or CPU stays pinned, add the server monitoring agent. It installs with one command and opens no ports.

The four layers

LayerCheckCatchesPlan
The machinePingHost off, network or routing downFree
Each serviceTCP portDatabase, SSH, mail or Redis stopped or firewalledFree
The appWebsite or APIErrors, slow responses, wrong contentFree
Inside the serverHeartbeatCron jobs, backups, disk full, outbound networkStarter and up

1. Ping the host

A Ping monitor sends three ICMP pings per check and records the round-trip time. It's the quickest signal that the machine itself is gone. Two caveats: many cloud firewalls drop ICMP by default (allow it from anywhere, or the check will always fail), and a host that answers ping can still have every service dead. That's what the next layer is for. Step-by-step ping setup.

2. A TCP check per service

A TCP port monitor opens a connection to a port and closes it. If the connection is refused or times out, the service is down even though the machine is up. Add one for each service that matters:

  • 22 SSH, so you know you can still get in
  • 5432 PostgreSQL, 3306 MySQL, 6379 Redis, 27017 MongoDB
  • 25, 587 or 993 for a mail server
  • Any game server, queue or custom service on its own port

Databases usually shouldn't be open to the internet. If yours is firewalled, allow only our check addresses, or skip it and let the app check (layer 3) prove the database works. Step-by-step TCP setup. For UDP services like game servers and NTP, see UDP monitoring.

3. Check the app, not just the port

Port 443 accepting connections doesn't mean the site works. A Website monitor with a Page must contain keyword, or an API monitor with JSON assertions on a health endpoint, proves the whole stack answers correctly. Point it at a route that touches the database, so a database failure shows up here too.

4. A heartbeat for what only the server sees

Some failures are invisible from outside: a backup that stopped, a disk filling up, a server that can't reach the internet. Turn them around. Have the server ping a Heartbeat URL on a schedule, and get alerted when the pings stop. This crontab line pings every 5 minutes, but only while the root disk is under 90% full:

*/5 * * * * [ "$(df --output=pcent / | tail -1 | tr -dc 0-9)" -lt 90 ] && curl -fsS -m 10 --retry 3 https://YOUR-HEARTBEAT-URL > /dev/null

The same pattern works for any condition you can test in a shell. More heartbeat examples.

Avoid false alarms

  • Confirm before alerting. Spot Downtime retries a failed check from a second region before opening an incident, so a single dropped packet doesn't wake anyone.
  • Check from where your users are. Pick regions near your audience in Check from.
  • Schedule maintenance. Pause alerts during planned reboots and upgrades.

Network devices too

Routers, firewalls and VPN gateways with a public address work the same way: a ping monitor for the device, and a TCP check for any port it serves. See ping monitoring and TCP port monitoring.

Get new guides by email

Practical posts on monitoring, outages, error fixes and on-call, when they're published. No spam.

Unsubscribe from any email with one click. See our privacy policy.

Keep reading