Chapter 11 · Lesson 1 of 10
Monitoring and logs

What to monitor first on a small server

Monitor a small server by watching the four golden signals (latency, traffic, errors, saturation) through a short list of checks: uptime from outside, disk, memory, error rate, certificate expiry and backups.

By the end you will

Choose a short, useful list of checks for a small server and know which signal each one covers.

Time
10 min
Level
Beginner
Check
4 questions
You need
  • A server or VPS running at least one service

To monitor a small server, watch the four golden signals: latency, traffic, errors and saturation. In practice that becomes a short list: an uptime check from outside, free disk, available memory, error rate, certificate expiry and backup age. Six checks cover most of the ways a one-server setup fails, and you can add more only when something actually bites you.

How it works#

The four golden signals come from site reliability engineering. They describe a service from the user’s side first and the machine’s side second.

  • Latency is how long a request takes. Slow answers often come before failures.
  • Traffic is how much demand the service gets, for example requests per second.
  • Errors is the share of requests that fail, such as HTTP 5xx responses or timeouts.
  • Saturation is how full a resource is: disk, memory, CPU, open connections.

On a small server you rarely need request-level graphs on day one. You need to know the site is reachable, nothing is about to run out, and the things that expire (certificates, backups) did not quietly stop working. The uptime monitoring basics are in monitor uptime simply; this lesson widens the list.

The first six checks#

CheckSignalWhy it mattersWhere to look
Site answers from outsideErrors, latencyTells you users are affected right nowA script or hosted checker on another machine
Free disk spaceSaturationA full disk stops databases, logs and deploysdf -h, node metrics
Available memorySaturationRunning out triggers the OOM killerfree -h, node metrics
Error rateErrorsCatches broken releases that still return pagesProxy access logs
Certificate expiryErrors (future)An expired certificate looks like a full outageopenssl, an expiry check
Backup age and sizeErrors (future)Backups fail silently until you need themTimestamp of the newest file

Latency and traffic come along for free once you graph the proxy logs or metrics later. See Prometheus and node exporter basics when you are ready for graphs.

Uptime from outside#

An external check answers the question that matters: can a visitor load the page. Run it from a machine that is not the server. It also exercises DNS, the network path and TLS in one request. Build a small one in uptime checks with a script and timer. Check the content or status code, not only that the port is open, because a proxy can answer while the app behind it is dead.

Disk, memory and CPU#

These are saturation checks. Disk and memory fail by running out, and they fail hard: a full disk makes writes fail, and exhausted memory wakes the kernel’s out-of-memory killer. A quick look is covered in check disk, memory and CPU usage. For alerts with sensible thresholds, see disk, memory and CPU alerts that matter. CPU is the least urgent of the three on most small servers. A busy CPU slows things down, while a full disk stops them.

Error rate#

Count failed requests from your reverse proxy log. Even grep -c ' 50[0-9] ' over the last few minutes shows a spike after a bad deploy. A broken release often returns a valid page with a 500 status, which a simple “port is open” check never sees. Pair this with read container logs when you need the cause.

Things that expire#

Certificates and backups share one trait: they work until a date, then stop, and nothing complains. Check the certificate’s expiry date from outside (see inspect a TLS certificate with openssl) and alert well before it, since renewal can fail for weeks without a visible symptom. For backups, check that the newest file is recent and not empty. A scheduled job that exits successfully but writes a 0 byte file passes most “did it run” checks. The 3-2-1 idea is in backups and the 3-2-1 rule.

What to leave for later#

Skip these on day one: per-endpoint latency percentiles, dozens of dashboards, tracing, and alerts on CPU percentage. They cost setup time and attention. Add one when an incident shows you need it.

Check it worked#

You have a usable first setup when each of these is true:

  • A failed request from a machine other than the server produces a message on your phone or chat.
  • You can name the free disk percentage right now without logging in to the server, or you have an alert for it.
  • You know the date your certificate expires and something warns you before it.
  • The newest backup is dated within your backup interval, and you have seen it restore.
  • You can say in one sentence which of the four signals each check covers.

Edge cases and gotchas#

  • Monitoring on the monitored host. If the server loses power or its network, a local agent cannot tell you. Keep at least one check on a different machine or provider.
  • Port open is not site up. A reverse proxy keeps answering while the app behind it returns 502 or hangs. Check a real URL and the response body or status.
  • Averages hide pain. An average response time can look fine while a few requests take many seconds. Look at slow requests, not only the mean.
  • Too many alerts train you to ignore them. Five noisy alerts are worse than two reliable ones. See alerting without alert fatigue.
  • Alerting on causes instead of symptoms. High CPU may be harmless, while a failed checkout is always real. Alert on what users feel and keep causes on dashboards.
  • The alert path is untested. A webhook with a wrong token fails silently. Trigger a test alert after setting it up and again every few months.

Troubleshooting#

SymptomLikely causeFix
No alert when the site went downCheck ran on the same serverMove the check to another machine or hosted service
Alert fires but nobody sees itWebhook URL or token wrong, or muted channelSend a manual test message and confirm delivery
Site is “up” but users see errorsCheck only tests the TCP portRequest a real URL and test the status code
Disk filled with no warningNo saturation alertAdd a free-space alert, see disk alerts lesson
Certificate expired unnoticedRenewal failed and nothing checked expiryAdd an expiry check and read the renewal logs
Backups missing when neededJob ran but wrote nothingCheck age and size of the newest file, test a restore
Alerts every few minutesNo repeat limit or flapping thresholdAlert on state changes and use a delay before firing
Graphs show gapsCollector down or host rebootedAlert on the collector itself, for example up == 0

Quick reference#

bash
# Outside check (run from another machine)
curl -fsS --max-time 10 -o /dev/null https://example.com/

# Disk and memory on the server
df -h /
free -h

# Certificate expiry date
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -enddate

# Newest backup file
ls -lt /var/backups/app | head -n 3

Related post: health checks that pass on a dead container.

Next#

Build the outside check in uptime checks with a script and timer.

Check what you learned4 questions
1Which golden signal does a nearly full disk belong to?
2Why should the uptime check run from a different machine?
3A backup job failed silently for a week. Which check would have caught it?
4Which signal is the best first alert for users?

Frequently asked questions

What are the four golden signals?

Latency, traffic, errors and saturation. They come from site reliability engineering practice and describe how fast a service answers, how much it is used, how often it fails and how full its resources are.

What should I monitor first on a new server?

Whether the site answers from outside, free disk space, available memory and certificate expiry. Add backups and error rates next. These few checks catch most real outages.

Do I need Prometheus to monitor a small server?

No. A script on another machine that checks your URL and a few commands for disk and memory are enough to start. Prometheus helps once you have several hosts or want history and graphs.

How many alerts should a small setup have?

Few. Alert only on things a human must act on soon, such as the site being down, a disk about to fill or a certificate about to expire. Everything else belongs on a dashboard.

Sources

View MD Edit
Share
Helpful?
Progress is saved in this browser only.

Keep going: guides and tutorials

View MD Edit
Share
Helpful?
Run this on your own server

Levelrail deploys apps from git with health-checked releases and one-click rollback.

docker pull ghcr.io/glincker/levelrail:latest Install Levelrail From GLINR Studios