Beamfar

Lightweight Linux server monitoring: CPU, memory, disk and load with a shell script

External HTTP checks tell you when a website stops answering, but they cannot see a Linux root disk filling up overnight or a worker leaking RAM before the kernel’s OOM killer terminates PHP or PostgreSQL. You do not need to run a full Prometheus, Grafana and exporter stack just to watch a handful of production VPS hosts. A readable POSIX /bin/sh script triggered once a minute by cron or a systemd.timer reads standard /proc counters and df, posts a tiny JSON payload over outbound HTTPS, and helps surface rising disk, memory or CPU pressure early.

Why external uptime checks alone leave a blind spot

Think of website monitoring in two halves:

  • Outside-in checks verify what a real visitor experiences: DNS resolution, TLS certificate validity, HTTP status codes, required page text and response time from external regions.
  • Inside-out host metrics watch the small set of server resources that cause the most predictable crashes on web servers, shops and small SaaS nodes.

Without basic host visibility, three routine problems turn directly into emergency downtime:

  1. A full root disk (/). Log rotation stops, backup archives pile up, or Docker layers fill the volume. The site keeps returning 200 OK at 94% disk usage, then sessions, database writes and TLS renewals fail abruptly at 100%.
  2. Steady memory pressure. A memory leak in PHP-FPM, Node.js or a queue worker eats available RAM over days until swap thrashes and the kernel kills the database or web server.
  3. Runaway CPU or load average. A stuck cron job, scraper spike or unindexed query pins every core. Pages slow down first, then reverse-proxy timeouts (502 / 504) open a site outage.
  4. A silent host. A server behind a firewall or running background workers without a public web endpoint freezes or reboots and never comes back. Because the script pushes metrics on a fixed schedule, a missing report doubles as a host-level heartbeat monitor.

Check it now. The free site check runs the monitoring’s own checks once on a public address: its answer, redirects, certificate, DNS, noindex, robots.txt, canonical and domain expiry. No account, and the address is not stored.

When a small shell script beats a heavy agent

Full observability platforms earn their keep on large microservice fleets where you need distributed tracing, custom PromQL dashboards and high-cardinality metrics. On 1 to 20 Linux or BSD servers powering client sites, WordPress/WooCommerce stores, Laravel apps or small SaaS backends, heavy agents often bring more overhead than value:

ApproachFootprint on hostPrivileges & portsBest fit
POSIX /bin/sh + curl push scriptZero background daemon; runs for milliseconds each minuteUnprivileged user, outbound HTTPS only, zero open inbound portsAgencies, freelancers, shops and lean teams watching 1–20 VPS hosts
Compiled binary agent / exporterAlways-on daemon, package repo updates, config managementOften root or dedicated service user; scrape exporters may open portsLarger infrastructure teams needing dozens of OS/kernel metrics
Full APM + log stackSignificant RAM/CPU overhead and ingest billingApplication instrumentation plus host agentEngineering teams debugging slow SQL queries and distributed traces

A readable shell script has one practical security advantage too: any system administrator can inspect every line in thirty seconds before putting it on a production box.

The five Linux metrics that often warn before a host outage

You do not need two hundred charts to spot common host bottlenecks. Five standard OS counters cover many host-caused outages, and all five are readable by an unprivileged user without installing extra packages:

  1. Root filesystem usage (df -Pk /). POSIX df -Pk prints 1024-byte blocks on a single predictable line across Debian, Ubuntu, Alpine, RHEL and BSD. Alerting at 85% to 90% gives you hours or days to prune logs or expand the volume instead of recovering a corrupt database at 100%.
  2. Memory usage (/proc/meminfo). Read MemTotal and MemAvailable — not MemFree. Linux intentionally uses spare RAM for disk cache (Buffers and Cached), so MemFree looks alarmingly low on a healthy server, while MemAvailable estimates how much memory can be allocated to applications without swapping.
  3. CPU usage (/proc/stat). Take two snapshots of the aggregate cpu tick counters separated by one second and compute the busy percentage (total_delta - idle_delta) * 100 / total_delta. One instant reading since boot only tells you the lifetime average, not what is happening right now.
  4. Load averages (/proc/loadavg). The 1-, 5- and 15-minute load averages count runnable and uninterruptible (disk I/O wait) tasks. Always read load relative to CPU core count (nproc): a load of 3.5 is relaxed on an 8-core box and saturated on a 2-core VPS.
  5. Uptime (/proc/uptime) and report freshness. Tracking uptime seconds makes unexpected reboots obvious, while tracking the time since the last received HTTPS POST alerts you when the host hangs, loses outbound connectivity or stops running cron.

Setting useful warning thresholds without alert fatigue

Bad thresholds create noisy alerts people learn to mute. Start with conservative defaults and tighten them only after observing a normal traffic week:

  • Disk (/): Start at 85% or 90%. Disk rarely spikes and self-heals; if it crosses 90%, somebody needs to look.
  • Memory: Start at 90%. Remember that healthy databases and caches intentionally run warm (70%–80%), so alerting at 75% causes constant noise.
  • CPU: Start at 90% and expect occasional brief spikes during backups or deployments; look at the 5-minute load average alongside CPU before paging.
  • Silence window (missed report): Set at least 3x your reporting interval (for example 180 to 300 seconds for a 1-minute cron job). One brief network retry should not trigger a false silent-host alert.
  • Maintenance windows: Mute host threshold and silent alerts during planned kernel reboots or upgrades while keeping metrics recorded in history.

Security checklist for any push-based server script

Running a script on a production server still requires basic hygiene:

  • Run as an unprivileged user. Reading /proc/stat, /proc/meminfo, /proc/loadavg, /proc/uptime and df -Pk / never requires root.
  • Keep tokens per-server and scoped. Each server should carry its own bearer token (stored in a chmod 600 file readable only by that user, never passed as a visible command-line argument if another local user can inspect ps), and rotating or revoking one host’s token must never affect other servers.
  • Never read application secrets or logs. A host health script should send only numeric resource stats and an optional host label — never .env files, process command lines or log excerpts.
  • Schedule cleanly with cron or systemd.timer. A cron line such as * * * * * /usr/local/bin/server-report.sh >/dev/null 2>&1 or a dedicated systemd.timer with OnBootSec=1min and OnUnitActiveSec=1min survives reboots predictably without leaving a resident daemon in RAM.

What lightweight server monitoring does not replace

Be honest about what a small shell script leaves out:

  • It does not trace slow SQL queries, inspect PHP stack traces or profile memory allocations inside your application.
  • It does not aggregate system logs or detect SSH brute-force attempts or rootkits.
  • It does not monitor secondary data mounts unless your check explicitly includes them.

Pair host metrics with external uptime checks (page text, TLS, DNS), scheduled-task heartbeats and deploy markers so you see both the visitor’s view and the host’s health on one timeline.

How Beamfar helps

Beamfar server monitoring is included on every paid plan from Solo upward. It has been tested with reports from a local agent, not yet on customers’ servers. Add a server in the app and paste its one-time install line on the host. It checks the installer’s SHA-256 first, then schedules the short, readable POSIX /bin/sh + curl script (Linux, BSD and macOS fallbacks) once a minute. Pasted as root on Linux (run sudo -i first), it creates a locked beamfar-agent system user with no login shell and no sudo and runs the script as that user, never as root; pasted as another user, it runs as that user. Beamfar tracks CPU, memory, root disk, 1/5/15-minute load averages and uptime alongside your external website checks, sends plain-language threshold, silent-host and recovery alerts through your configured channels (respecting maintenance windows), and lets agencies link each server to a site or client. See the pricing page for plan limits, or run a free site check on your public domain first.

Questions

Does the server monitoring script require root access or a background daemon?

No. Reading /proc counters and df -Pk / works as an unprivileged user, and running the script from cron or a systemd timer leaves no resident daemon in memory and opens no inbound ports. If you paste the Beamfar install line as root on Linux (after sudo -i), it creates a locked beamfar-agent user and runs the script as that user; the script itself refuses to run as root.

Why does Linux show almost zero free RAM even when my server is healthy?

Linux uses unused memory for filesystem page cache and releases it immediately when applications ask for RAM. Monitor MemAvailable from /proc/meminfo rather than MemFree so normal caching does not trigger false memory alerts.

How does silent-host detection work if the server freezes or loses network?

Because the script pushes a metric report every minute, silence is the signal. If no report arrives within your configured silence window (for example 3 to 5 minutes), the monitor raises a silent-host alert and sends a recovery notice once reports resume.

Which Beamfar plans include server monitoring?

Server monitoring is included on every paid plan starting from Solo, alongside external website checks (every 5 minutes on Free, every minute from Solo, every 30 seconds from Team when you choose it), heartbeat monitors and multi-channel alerts. The Free plan monitors one site from outside every 5 minutes without server metric pushes.

Sources

Read on . Standards and vendor pages change; confirm the current text before you rely on it.

Terms used in this guide

  • Uptime monitoringUptime monitoring requests a website from outside at intervals and alerts when it fails to answer. What it measures, what it misses and how it is confirmed.
  • Heartbeat monitoringHeartbeat monitoring waits for a scheduled job to report in and alerts when the signal is missing. How the period and grace time work and what it is good for.
  • Cron jobA cron job is a task scheduled to run at set times on a server. Why it fails silently, how WP-Cron differs from system cron and how to monitor it.
  • IncidentAn incident is a period in which a monitored site is confirmed to be failing, from first confirmation to recovery. What an incident record should hold.

Try it on your own sites.

Add your sites: checking starts as soon as you do.

No card for the Free plan.