-
Step 1 · Get a server and install a hosting panel
A 2-core / 2 GB box with a control panel on it
Run the monitoring dashboard on its own machine, not alongside your main workload — if the service dies and monitoring dies with it, the monitoring was pointless.
Two vCPU and 2 GB of RAM with a few Mbps of bandwidth is enough, for roughly US$10–15 a year on an entry plan. Prefer Ubuntu 22.04 or another supported LTS; panels behave best on those.
Three things before anything else:
- Open ports 22, 80, 443 and the panel port in the cloud console's security group
- Point a subdomain at this machine (for example
monitor.example.com) with an A record - SSH in and run the setup script to install the panel
Checklist
- SSH works and the panel command is available
- The panel port is open in the security group
- The subdomain resolves to this machine's IP
-
Step 2 · Deploy the collection script
Collect CPU / memory / disk / processes into JSON
Monitoring is three stages: collect → store → display. This step covers the first two.
Each run of the collector writes these metrics into a JSON file:
- CPU usage and load average (1 / 5 / 15 minutes)
- Memory usage and swap usage
- Disk usage per partition
- Whether key processes are alive (nginx, php-fpm, mysql)
- System uptime
Write it to a fixed path such as
/www/wwwroot/monitor.example.com/data/status.json, and the front end can fetch that file and draw the charts.Why land it in JSON instead of querying a database? Because the front end stays a static page. However you decide to collect later, not a line of front-end code has to change.
Checklist
- Running the script produces status.json
- The values look sane — CPU isn't 0 or 100
- http://domain/data/status.json opens in a browser
-
Step 3 · Configure alerting (chat webhook / email)
Push threshold breaches to your phone instead of staring at a screen
Monitoring that nobody looks at is monitoring you didn't do. It has to come find you when something's wrong.
Options, easiest first:
- A chat bot webhook: create a group with only yourself in it, add a custom bot, take the webhook URL, and POST a JSON from the script. Free and unlimited
- Your existing chat platform's bot: same idea — take the webhook from the group settings. Cheapest if you already use it
- Telegram bot: ask BotFather for a token. The best option for servers outside China
- Email: most panels can do it, but it's the least real-time. Treat it as a fallback
Suggested thresholds:
- CPU above 90% for 5 straight minutes
- Memory usage above 90%
- Disk usage above 85%
- A key process is missing
The one principle that matters: add a silence window. Send the same alert at most once per 10 minutes, or you'll get two hundred messages overnight and switch alerts off entirely.
Checklist
- Lowering a threshold produces a test alert
- You can read the alert on your phone
- The same alert isn't repeated inside the silence window
-
Step 4 · Schedule it and make it survive a reboot
Collect once a minute; come back automatically after a restart
Once the script works, make it run on its own.
Option 1: the panel's scheduler (best if you're new to this) — scheduled tasks → add task → type "shell script" → period "every N minutes" → 1 → paste the script's absolute path.
Option 2: crontab (lighter) —
crontab -eand add:* * * * * /bin/bash /root/monitor/collect.sh >/dev/null 2>&1Start on boot — if the collector is a long-running daemon rather than a per-minute script, write a
.servicefile into/etc/systemd/system/and then run:systemctl daemon-reload && systemctl enable monitor && systemctl start monitorFinally, reboot the server to verify: after it comes back, metrics should keep updating without you logging in.
Checklist
- The new task shows up in the scheduler list
- status.json's update time advances every minute
- Collection resumes automatically after a reboot
-
Step 5 · Dashboard + backup strategy
Turn the JSON into charts, and back up the config
Last step: make the data readable at a glance.
Display layer: a single static HTML page that fetches status.json every 30 seconds with
setIntervaland renders a few progress bars plus number cards. You don't need a charting library — plain CSS bars are the sturdiest and fastest option.Colour conventions (don't underestimate these):
- Normal: green
- Warning (above 80%): amber
- Critical (above 90%): red
With that, one glance tells you whether anything is wrong; you never have to read the numbers.
Backup strategy: the monitoring config is small, but rewriting it is annoying.
- Panel → scheduled tasks → back up the site, weekly
- Include the script directory
/root/monitor/in the archive - Store it in object storage, and keep a local copy as well
Weekly five-minute checklist:
- Is the dashboard still updating?
- Do alerts still arrive? Test one on purpose
- Is disk growth trending oddly?
Checklist
- The dashboard refreshes every 30 seconds
- Bars turn amber / red past the thresholds
- The backup job exists and runs successfully by hand