A lightweight admin Dashboard block that gives Moodle site administrators a live view of server health — CPU, RAM, disk, top processes, Moodle page-performance metrics, cache store stats, session info, and historical metric logging with CSV export. All data is visible only to site administrators.
Three colour-coded progress bars (green / amber / red at 60% / 80%) show at a glance:
/proc/stat two-sample delta), plus per-core breakdown
bars and 1m/5m/15m load averages/proc/meminfo/data)A collapsible panel that polls the server every 5 seconds via AJAX while open and stops when
collapsed. Displays PID, process name, CPU%, MEM%, and the last CPU core the process ran on for
the top 5 processes. Reads /proc/[pid]/stat directly with a 200 ms sample window;
falls back to ps -A --sort=-%cpu -o pid,pcpu,pmem,psr,comm if /proc is
unavailable. The Core column lets you cross-reference a saturated core in the per-core CPU bars
with the process responsible.
A collapsible panel showing Moodle page-performance data for the current request:
/proc/meminfo) and cron freshness with a failing-task countA collapsible panel for auditing whether a multi-tenant server isolates sites correctly. It shows
which OS user the current request runs as, lists login-capable operating-system users from
/etc/passwd (UID ≥ 1000), and parses PHP-FPM pool configuration from the
standard locations (/etc/php/*/fpm/pool.d/, /etc/php-fpm.d/,
/usr/local/etc/php-fpm.d/). Each pool is rendered as a card showing its user/group,
listen socket and hardening directives (open_basedir, chroot,
listen.mode), cross-referenced against real accounts and flagged for problems such as
generic/shared/root users, world-writable sockets, shared home directories or a missing
open_basedir fence. It also detects whether /proc lacks
hidepid (so other tenants' processes and command-line arguments are visible). A
best-effort, always-unconfirmed verdict summarises the result.
A scheduled task records CPU (per-core %), RAM%, and disk% every 5 minutes to a lightweight database table. A Download metrics CSV (last 7 days) link appears at the bottom of the block when data is available, with one column per CPU core.
A best-effort resource-scoring heuristic estimates the server environment (shared hosting,
small VPS, or VPS/dedicated) from visible CPU cores, RAM, /proc readability, and the
PHP process owner. The label is always marked as unconfirmed and the matched signals are listed
so administrators can see why the guess was made.
A single setting under Site Administration → Plugins → Blocks → Server Monitor
lets you specify the disk path to monitor (default /). This also applies to the
scheduled task so logged values match what is displayed.
A button at the bottom of the block opens the browser's print dialog (and its "Save as PDF" option). A print stylesheet hides the rest of the page so only the block prints, keeps the colour-coded bars and badges, expands the collapsible sections, and adds a header with the plugin name, hostname and timestamp. This is a client-side print, so the output matches exactly what the browser renders.
Block content, the AJAX process endpoint, and the CSV export endpoint all require the
moodle/site:config capability. No other user sees any output. No personal data is
stored — the metric log records server-level values only.