Monitoring your server’s CPU load history is essential for diagnosing performance issues, identifying spikes, and ensuring optimal operation of your VPS or Dedicated Server. Below are quick methods to check historical CPU loads via SSH, including cPanel-specific tools.
🔹 General Method (Using sar
)
sar
is part of the sysstat
package and provides historical system activity reports.
- Access your server via SSH
Connect to your VPS or Dedicated Server asroot
or a sudo-enabled user. - Run
sar
sar
By default,sar
will display the average CPU usage for the day.- To see CPU history for a specific day (e.g., yesterday), use:
sar -f /var/log/sa/sa$(date --date="yesterday" +%d)
- To display specific intervals:
sar -u 1 5
(This shows CPU usage every second for five times.)
- To see CPU history for a specific day (e.g., yesterday), use:
Note: If sar
is not installed, you can install it with:
# On AlmaLinux / CentOS / RHEL:
sudo dnf install sysstat
# On Ubuntu / Debian:
sudo apt install sysstat
🔹 Under cPanel (Using dcpumonview
)
cPanel’s dcpumon
tool tracks CPU and memory usage by individual cPanel accounts.
- Show all recorded CPU usage history:
/usr/local/cpanel/bin/dcpumonview
- Filter history by specific cPanel username:
/usr/local/cpanel/bin/dcpumonview | grep username
Replaceusername
with the actual cPanel account username you want to check.
✅ Tip: Regularly reviewing CPU load history can help you catch processes consuming excessive resources, optimize configurations, and plan for scaling.
Automating CPU load monitoring and alerting will help you catch issues proactively before they impact your services. Here’s a guide to set it up:
🚨 Automate CPU Load Monitoring & Alerts
Automatically monitor CPU load and get alerts via email or other channels when load exceeds safe thresholds.
🔹 1) Using cron
+ Custom Script
You can create a simple script to check the load average and email you if it’s too high.
Example script:
#!/bin/bash
# File: /usr/local/bin/check_load.sh
# Set your desired load threshold (e.g., 5.0)
THRESHOLD=5.0
# Get the 1-minute load average
LOAD=$(awk '{print $1}' /proc/loadavg)
# Compare using bc for floating-point support
if (( $(echo "$LOAD > $THRESHOLD" | bc -l) )); then
echo "High CPU Load Alert! Current Load: $LOAD" | mail -s "Server CPU Load Alert" [email protected]
fi
- Make the script executable:
chmod +x /usr/local/bin/check_load.sh
- Add a cron job to check every 5 minutes:
crontab -e
Add:*/5 * * * * /usr/local/bin/check_load.sh
✅ This setup will email you if the server’s 1-minute load average exceeds your threshold.
🔹 2) Using CSF/LFD (If Installed)
If you use CSF (ConfigServer Security & Firewall) — which many cPanel servers do — it includes lfd
(Login Failure Daemon) that can monitor load averages and send alerts.
Configure LFD load thresholds:
- Edit CSF configuration:
nano /etc/csf/csf.conf
- Look for:
PT_LOAD PT_LOAD_LEVEL
PT_LOAD
enables/disables load checking (0
=off,1
=on).PT_LOAD_LEVEL
sets the threshold (e.g.,5
for a load of 5).
PT_LOAD = "1" PT_LOAD_LEVEL = "5"
- Save the file and restart CSF/LFD:
csf -r
LFD will then email the configured LF_ALERT_TO
address if the load average exceeds the set level.
🔹 3) Using Netdata (Optional but Powerful)
Netdata is a free real-time monitoring tool with beautiful web dashboards and built-in alerting.
- Install on cPanel servers (safe and lightweight):
bash <(curl -Ss https://my-netdata.io/kickstart.sh)
- Access your Netdata dashboard at:
http://your-server-ip:19999
- Configure alerts in
/etc/netdata/health.d/cpu.conf
or through the Netdata Cloud UI.