Security

Monitoring a small server: uptime, disk and alerts

The monitoring a single production server needs: an uptime check from outside, disk and memory alerts to your phone, logs that don't fill the disk, and a heartbeat for your backups. Free options, and a tested script.

TL;DR

  • Start with an uptime check from outside the server that requests your health route and alerts you; UptimeRobot's free plan or a self-hosted Uptime Kuma on another machine both do it.
  • Add disk and memory alerts: a 20-line script on a systemd timer that posts to ntfy (opens in a new tab) when a disk passes 85% is enough for one server, and we tested it.
  • Stop logs from filling the disk: Docker (opens in a new tab)'s default json-file driver keeps logs forever, so set the local driver or max-size in daemon.json, and cap journald with SystemMaxUse.
  • Give scheduled jobs a heartbeat: the backup pings a URL when it succeeds, and a missing ping is the alert.
On this page

To monitor a VPS that runs one app, you need four things before any dashboard: an uptime check from outside the server, an alert when a disk fills up or memory runs out, logs that rotate, and a heartbeat for scheduled jobs such as the backup. All four can be free. We tested the script and the log settings on Ubuntu 24.04 with Docker 29.9.3 on 11 November 2026, with alerts sent to a local test server.

It is the last step of our checklist for hardening an Ubuntu 24.04 server.

1. Monitor your VPS from outside: an uptime check

A check that runs on the server can't report that the server is down, and it can't see what breaks between the internet and your app: DNS, an expired certificate, a firewall rule. So the first check runs somewhere else.

What to check. Request your app's health route over HTTPS, for example https://example.com/health, and treat anything other than a 200 within a few seconds as down. A health route that also queries the database tells you more than the home page does. Retry once before alerting, so a single slow response doesn't wake you.

Where to run it:

  • A hosted service. UptimeRobot's free plan, on 11 November 2026, offered 50 monitors checked every 5 minutes, "good for personal and commercial projects". Several other services have similar free tiers; pick one that can notify your phone.

  • Uptime Kuma, self-hosted. Open source (MIT), it checks HTTP(S), keywords in a page, TCP ports, DNS records and more at intervals down to 20 seconds, and sends notifications to over 90 services. Its README runs it with one command:

    docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:2

    Run it on a different machine from the one it watches, such as a second small server or a computer at home. Note that -p 3001:3001 publishes its dashboard on every address of that machine, around ufw; use -p 127.0.0.1:3001:3001 and reach it through SSH or a VPN if that machine is on the internet.

We didn't test either service for this article; both are described from their own pages.

2. Disk and memory alerts

A full disk is a common quiet failure on a small server: logs, old images and dumps grow until the database can't write. This script checks every real filesystem and the memory still available, and posts to ntfy when either crosses its limit. ntfy sends push notifications to its app for Android and iOS; on the public ntfy.sh server there is no sign-up and, as its documentation puts it, "the topic is essentially a password", so pick a long random one.

/usr/local/sbin/server-check:

#!/bin/sh
# Alert when a disk is too full or memory is running out. Run it every 5 minutes from a timer.
DISK_LIMIT="${DISK_LIMIT:-85}"       # percent of a filesystem in use
MEM_MIN_MB="${MEM_MIN_MB:-200}"      # memory still available, in MB
NTFY_URL="${NTFY_URL:-https://ntfy.sh/replace-with-a-long-random-topic}"

alert() {
  curl -fsS -m 10 --retry 3 -H "Title: $1 on $(hostname)" -d "$2" "$NTFY_URL" >/dev/null
}

df -P -x tmpfs -x devtmpfs -x overlay -x squashfs -x efivarfs | awk 'NR > 1 { sub("%", "", $5); print $5, $6 }' |
while read -r used mount; do
  if [ "$used" -ge "$DISK_LIMIT" ]; then
    alert "Disk ${used}% full" "$mount is ${used}% full (alert at ${DISK_LIMIT}%)."
  fi
done

avail_mb=$(awk '/^MemAvailable:/ { print int($2 / 1024) }' /proc/meminfo)
if [ "$avail_mb" -lt "$MEM_MIN_MB" ]; then
  alert "Low memory" "Only ${avail_mb} MB of memory available (alert below ${MEM_MIN_MB} MB)."
fi

df -x overlay skips the layered filesystems of running containers, which only mirror the real disk, and -x squashfs skips snap packages, which always show as 100% full. MemAvailable is the kernel's estimate of memory that programs can still get without swapping, a better signal than "free".

Run it from a systemd service and timer. /etc/systemd/system/server-check.service:

[Unit]
Description=Disk and memory check

[Service]
Type=oneshot
Environment=NTFY_URL=https://ntfy.sh/replace-with-a-long-random-topic
ExecStart=/usr/local/sbin/server-check

/etc/systemd/system/server-check.timer:

[Unit]
Description=Run the disk and memory check every 5 minutes

[Timer]
OnCalendar=*:0/5
Persistent=true

[Install]
WantedBy=timers.target
sudo chmod 755 /usr/local/sbin/server-check
sudo systemctl daemon-reload
sudo systemctl enable --now server-check.timer

Replace the topic in both files with your own. To see an alert arrive, run it once with limits it must cross:

sudo NTFY_URL=https://ntfy.sh/your-topic DISK_LIMIT=1 MEM_MIN_MB=999999 /usr/local/sbin/server-check

In our test, with NTFY_URL pointed at a local test receiver, both messages arrived:

Disk 6% full on srv: /etc/hosts is 6% full (alert at 1%).
Low memory on srv: Only 9105 MB of memory available (alert below 999999 MB).

(The mount shows as /etc/hosts because the test ran in a container; on a server it is /.) The script repeats an alert every 5 minutes for as long as the problem lasts. If that gets noisy, the tools in step 5 keep state and alert once.

When the disk alert fires, the usual culprits on a Docker host are old images (docker system df shows them, docker image prune removes unused ones), container logs (next step), old backups or dumps, and the journal.

3. Logs that can't fill the disk

Docker. By default Docker uses the json-file log driver, and Docker's documentation is direct about it: "By default, no log-rotation is performed." Docker recommends the local driver, which rotates by default (five files of 20 MB, 100 MB per container) and compresses. Set it for all new containers in /etc/docker/daemon.json:

{
  "log-driver": "local",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  }
}

Restart Docker (sudo systemctl restart docker) and recreate your containers (docker compose up -d --force-recreate): Docker's documentation notes that existing containers don't pick up a new logging configuration. The values in log-opts must be strings, in quotes. In our test, containers created afterwards showed local map[max-file:3 max-size:10m] in docker inspect. If you'd rather set it per service, Compose takes the same options:

services:
  app:
    image: ghcr.io/you/app:latest
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"

Reading them stays the same with either driver:

docker compose logs --since 1h --tail 100 app
docker compose logs -f

The system journal. Services such as SSH, Docker itself and the update timers log to journald. Its default limit is 10% of the filesystem, capped at 4 GB. On a small disk, cap it lower with a drop-in, /etc/systemd/journald.conf.d/size.conf:

[Journal]
SystemMaxUse=500M
sudo systemctl restart systemd-journald
journalctl --disk-usage

A few queries worth knowing:

journalctl -u ssh --since today        # one service, today
journalctl -p err -b                   # errors since the last boot
journalctl -u docker --since "1 hour ago"

4. Heartbeats for scheduled jobs

The nightly backup is the job whose failure you notice last. Turn its silence into an alert: after each successful run it requests a unique URL, and a heartbeat service alerts you when the request doesn't come within the expected period. Healthchecks.io's free Hobbyist plan monitors 20 jobs (on 11 November 2026), and it is open source if you'd rather host it yourself. Its ping URLs are https://hc-ping.com/<uuid> for success and /fail appended for an explicit failure.

In a systemd service, one line does it, because ExecStartPost runs only when the main command succeeded:

ExecStartPost=/usr/bin/curl -fsS -m 10 --retry 5 -o /dev/null ${HC_PING_URL}

We tested exactly that in our article on backups you can restore: a successful run sent the ping, and a failed run sent nothing.

5. Charts and history, when you want them

The steps above tell you when something is wrong. For "why", and for trends such as memory creeping up over weeks, add history. Options from lightest to heaviest:

If you want a self-hosted monitoring tool, start with Beszel to spot which host or container is running out of resources. Use Prometheus if you also need to query metrics from your own app or exporters and write alert rules around them. Either way, keep the public uptime check on a different machine or service so it can alert you when the entire app host is offline.

Doing this with OpsCrew

OpsCrew, an open-source tool that deploys apps to servers you own, covers each step:

Where to go next

If you haven't yet, work through the rest of the Ubuntu server hardening checklist, starting with securing SSH, and keep the deploy side healthy with our guide to deploying a web app to a VPS.

Key facts

FactValueSource
UptimeRobot Free plan50 monitors, checked every 5 minutes"Good for personal and commercial projects", as the pricing page put it.UptimeRobot pricing (opens in a new tab)Verified on
Healthchecks.io Hobbyist planFree, 20 jobsHealthchecks.io pricing (opens in a new tab)Verified on
Grafana Cloud Free tier10k active metric series, 50 GB of logs a month, 14 days of retentionGrafana pricing (opens in a new tab)Verified on
Docker's default log driverjson-file, with no rotationDocker's documentation recommends the local driver, which keeps 100 MB per container by default (5 files of 20 MB).Docker documentation, Configure logging drivers (opens in a new tab)Verified on
journald's default size limit10% of the file system, capped at 4 GBjournald.conf(5) (opens in a new tab)Verified on

Frequently asked questions

What should I alert on for a small server?

Four checks cover the usual failures: the app's health route not answering from outside, a disk above about 85%, available memory running out, and a scheduled job such as the backup not reporting in. Certificate expiry is worth a check too if your proxy renews certificates by itself and you want to know when renewal fails.

Where are the logs on Ubuntu 24.04?

System services log to the systemd journal: read it with journalctl, for example journalctl -u ssh --since today or journalctl -p err -b for errors since boot. Containers' output is read with docker logs or docker compose logs. Some services also write files under /var/log, such as /var/log/unattended-upgrades/.

Sources

  1. UptimeRobot pricing (opens in a new tab), UptimeRobot, accessed on
  2. Uptime Kuma (opens in a new tab), Uptime Kuma, accessed on
  3. Healthchecks.io pricing (opens in a new tab), Healthchecks.io, accessed on
  4. Healthchecks.io HTTP API (opens in a new tab), Healthchecks.io, accessed on
  5. Publishing (ntfy documentation) (opens in a new tab), ntfy, accessed on
  6. Beszel (opens in a new tab), Beszel, accessed on
  7. Grafana pricing (opens in a new tab), Grafana Labs, accessed on
  8. node_exporter (opens in a new tab), Prometheus, accessed on
  9. Configure logging drivers (opens in a new tab), Docker, accessed on
  10. Local file logging driver (opens in a new tab), Docker, accessed on
  11. JSON File logging driver (opens in a new tab), Docker, accessed on
  12. journald.conf(5) (opens in a new tab), systemd, accessed on
  13. Prometheus overview (opens in a new tab), Prometheus, accessed on
Edit this article
  • Deploying

    Deploy a Docker app to a DigitalOcean Droplet

    Create a Droplet, lock it down with a Cloud Firewall, install Docker from Docker's own repository, and run your app with Compose and automatic HTTPS. Every command tested; prices checked on 11 November 2026.

    8 min read

  • Security

    How to scan a git repository for leaked secrets

    Scan a repository's full history for leaked keys with gitleaks and TruffleHog in Docker, add a pre-commit hook, know what GitHub's secret scanning covers, and clean up after a leak: rotate first, then rewrite history.

    8 min read

  • Deploying

    Cloudflare Tunnel for a self-hosted app: setup, Docker and SSH

    What a Cloudflare Tunnel is, quick tunnels and named tunnels, a tested Docker Compose setup with a tunnel token, SSH through Cloudflare Access, and the limits that come with sending every request through Cloudflare.

    11 min read

Put OpsCrew to work on your app.

Run npx opscrew init in your app's repository. It checks your tools and tokens first, for free.