Automated WHM Health Checks: Setup & Email Digests Guide
Automate daily WHM health checks on AlmaLinux or Ubuntu with a lightweight Bash script, cron scheduling, and email alerts for uptime, resources, and service status.
5 min read
Introduction
For a web-hosting business or a developer managing multiple sites, keeping a WHM/cPanel server healthy is vital. WHM offers built-in monitoring, but many administrators prefer a lightweight, automated script that runs daily, checks the most critical metrics, and sends a concise email digest. This article shows how to build such a script, schedule it with cron, and configure email delivery on both AlmaLinux/RHEL and Debian/Ubuntu hosts.
1. Prerequisites
Root or sudo access to the server.
WHM/cPanel installed and operational.
An MTA such as exim (default on WHM) or postfix installed.
Basic familiarity with the command line.
2. Install Required Utilities
The script uses a handful of command-line tools. Install them with your distribution’s package manager.
AlmaLinux / Rocky Linux / RHEL (dnf)
# dnf install -y sysstat net-tools mailx
sysstat supplies iostat and mpstat for CPU/disk I/O.
net-tools provides ifconfig for quick network checks.
mailx is a simple mail client that works with Exim.
# echo "Test message from WHM health-check script" | mail -s "WHM Test" admin@example.com
If the message does not arrive, inspect the MTA logs (/var/log/exim_mainlog for Exim or /var/log/mail.log for Postfix) and verify that outbound connections on port 25 (or the submission port used by your provider) are allowed.
7. Optional Enhancements
Log rotation: Append > /var/log/whm-health.log 2>&1 to the cron line and configure logrotate to keep a limited number of logs.
Threshold alerts: Add if statements to compare CPU load or disk usage against a limit and prepend “ALERT:” to the email subject.
JSON output: Replace plain-text sections with jq-compatible JSON for integration with monitoring platforms like Grafana.
Conclusion
Automating daily health checks removes guesswork from routine maintenance. By installing standard utilities, creating a concise Bash script, and scheduling it with cron, you receive a single email each morning that highlights uptime, resource usage, service status, and any emerging issues. This approach works on both AlmaLinux/RHEL and Debian/Ubuntu, giving you flexibility while staying within the familiar Linux toolset. Regularly reviewing the digest helps you act before small problems become service-affecting outages, keeping your hosted sites and applications running smoothly for Indian users.
whmcpanellinux health checkcron jobemail monitoringsysstatmailutilsserver administration
Try it on your own server
Follow along on a Cloud VPS with full root access, or read the step-by-step knowledge base guides.