Your server went down and you heard it from your clients: simple monitoring in 15 minutes

Questions and discussions about VPS plans, Linux setup, WordPress, Nginx, NAT and VPS configuration in Bulgaria.
rychy
Site Admin
Posts: 162
Joined: Tue Oct 20, 2026 10:45 am

Your server went down and you heard it from your clients: simple monitoring in 15 minutes

Post by rychy »

🇧🇬 Прочети на български

🚨 Your server went down and you heard it from your clients: simple monitoring in 15 minutes

The worst way to learn that your site is down is a client writing "something won't open". Usually the server stopped hours earlier: the disk filled up, memory ran out, or the machine simply rebooted and the service didn't start. The good news: you don't need an expensive system to be the first to know. Three checks and a notification on your phone are enough.

👀 What to watch

  • Is it alive: does the site open, does SSH answer. This is checked from outside, because a server that is down cannot report that it is down.
  • Disk: a full disk is the number one cause of "mysterious" crashes. The database stops writing, logs stop, the site returns error 500.
  • RAM: when memory runs out, Linux kills the biggest process. Usually that is MySQL/MariaDB, and the site is left without a database.

1️⃣ Check from outside (5 minutes)

Sign up for a free uptime checking service such as UptimeRobot and add:
  • an HTTP(s) monitor for your site's address, if you have a site;
  • a Port monitor for the server's SSH port, if you don't.
The service checks every few minutes and sends you an email or app notification when the address stops answering, and again when it comes back.

💡 If you prefer your own solution, Uptime Kuma is free and runs as a single Docker container. Just don't put it on the same server you are watching: when that one goes down, both go down.

2️⃣ Disk and RAM with a small script (10 minutes)

The outside check can't see the disk or memory. For those, a script run from cron is enough. It sends a notification to your phone through ntfy, a free app for Android and iOS. Sending a notification is a single curl command, with no sign-up.

1. Install the ntfy app and subscribe to a topic with a long random name, for example my-server-k7q2x9. Anyone who knows the name can read the notifications, so never put passwords in them.
2. Create the script:

Code: Select all

sudo nano /usr/local/bin/check-server.sh

Code: Select all

#!/bin/sh
TOPIC=my-server-k7q2x9
DISK_LIMIT=90
RAM_MIN_MB=200

# disk: every filesystem above the limit
df -P -x tmpfs -x devtmpfs | awk -v l=$DISK_LIMIT 'NR>1 {sub("%","",$5); if ($5+0 >= l) print $6, $5"%"}' |
while read fs pct; do
  curl -s -d "$(hostname): disk $fs is $pct full" https://ntfy.sh/$TOPIC >/dev/null
done

# RAM: how many MB are really available
free_mb=$(free -m | awk '/^Mem:/ {print $7}')
if [ "$free_mb" -lt "$RAM_MIN_MB" ]; then
  curl -s -d "$(hostname): only $free_mb MB RAM available" https://ntfy.sh/$TOPIC >/dev/null
fi
3. Make it executable, try it, and add it to cron every 10 minutes:

Code: Select all

sudo chmod +x /usr/local/bin/check-server.sh
sudo /usr/local/bin/check-server.sh
echo '*/10 * * * * root /usr/local/bin/check-server.sh' | sudo tee /etc/cron.d/check-server
To see that notifications reach your phone, temporarily change DISK_LIMIT=90 to 1, run the script, then change it back.

⚠️ The script notifies you every 10 minutes for as long as the problem lasts. That is on purpose: it is hard to miss.

🔍 The server already went down. How to find out why

  • When it rebooted: last -x reboot | head
  • Errors from the previous boot: journalctl -b -1 -p err
  • Did memory run out: journalctl -k | grep -i "out of memory"
  • What fills the disk: sudo du -xh / --max-depth=2 | sort -h | tail -15
If journalctl -b -1 says there is no previous boot, logs are not kept across reboots. Fix it like this:

Code: Select all

sudo mkdir -p /var/log/journal
sudo systemctl restart systemd-journald

🚀 With us: the free Monitoring add-on

When you order a VPS from us, you can turn on the free Monitoring add-on. Every 5 minutes we check from outside that your server is running, that it answers on SSH (or RDP on Windows) and that the disk is not above 90 %. If there is a problem you get an email, and a second one when it is fixed. Nothing is installed on your machine. It works on all plans, including Windows.

How do you find out that your server has a problem? Post here in the topic 👇

Return to “VPS questions and setup”