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-filedriver keeps logs forever, so set thelocaldriver ormax-sizeindaemon.json, and cap journald withSystemMaxUse. - 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:2Run 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:3001publishes its dashboard on every address of that machine, around ufw; use-p 127.0.0.1:3001:3001and 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)."
fidf -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.targetsudo chmod 755 /usr/local/sbin/server-check
sudo systemctl daemon-reload
sudo systemctl enable --now server-check.timerReplace 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-checkIn 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 -fThe 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=500Msudo systemctl restart systemd-journald
journalctl --disk-usageA 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:
- Beszel (opens in a new tab) (MIT): a small hub and agent that keep a history of the server's and each container's CPU, memory and network, with configurable alerts.
- Grafana Cloud (opens in a new tab)'s free tier: 10k active metric series, 50 GB of logs a month and 14 days of retention, with no stack to run. You install a collector on the server.
- Prometheus with node_exporter, plus Grafana and Alertmanager, self-hosted: the most control and the most to maintain. If you go this way, keep the exporter off the internet. In our test, node_exporter 1.12.1 in Docker with
--net=hostand--web.listen-address=127.0.0.1:9100served its figures on the server and nothing from outside.
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:
- Uptime and disk alerts: its scheduled check runs in GitHub Actions (opens in a new tab), outside your server. It requests each hostname's health path over HTTPS, warns when a certificate has fewer than 14 days left, reads each server's disk (alerting at 85% and 95%), and checks scheduled snapshots. A failure opens a GitHub (opens in a new tab) issue, which closes by itself on recovery, and it can post to Slack (opens in a new tab), Discord (opens in a new tab) or ntfy. By default it runs every 60 minutes in a private repository and every 15 in a public one.
- Logs and figures:
npx opscrew logsandnpx opscrew statusshow the app's latest lines and its CPU, memory, disk and restarts from your terminal (logs and status), and Docker is set up with log limits. - History: Beszel, Grafana Cloud or a self-hosted Prometheus, Loki and Grafana stack can be added, each off until you turn it on and each shown as a plan you approve first.
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
| Fact | Value | Source |
|---|---|---|
| UptimeRobot Free plan | 50 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 plan | Free, 20 jobs | Healthchecks.io pricing (opens in a new tab)Verified on |
| Grafana Cloud Free tier | 10k active metric series, 50 GB of logs a month, 14 days of retention | Grafana pricing (opens in a new tab)Verified on |
| Docker's default log driver | json-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 limit | 10% of the file system, capped at 4 GB | journald.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
- UptimeRobot pricing (opens in a new tab)
- Uptime Kuma (opens in a new tab)
- Healthchecks.io pricing (opens in a new tab)
- Healthchecks.io HTTP API (opens in a new tab)
- Publishing (ntfy documentation) (opens in a new tab)
- Beszel (opens in a new tab)
- Grafana pricing (opens in a new tab)
- node_exporter (opens in a new tab)
- Configure logging drivers (opens in a new tab)
- Local file logging driver (opens in a new tab)
- JSON File logging driver (opens in a new tab)
- journald.conf(5) (opens in a new tab)
- Prometheus overview (opens in a new tab)
Related articles
- 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.
- 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.
- 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.