This quick guide shows you how to email the full System Activity Report (SAR) output, including average CPU load and other useful metrics.
1. Install sysstat (if not already installed)
SAR is part of the sysstat package. To install it on AlmaLinux or CentOS:
yum install sysstat -y
2. Enable SAR Logging
Ensure SAR data is being collected. Enable it in /etc/default/sysstat
or /etc/sysconfig/sysstat
:
nano /etc/sysconfig/sysstat
Make sure this line is set:
ENABLED="true"
Then restart the service:
systemctl enable sysstat
systemctl start sysstat
3. Send Average CPU Loads via Email
To send all SAR output (which includes CPU usage) to an email address:
sar -A | mail -s "SAR output" [email protected]
Replace
[email protected]
with your actual email address.
This command will:
- Gather all available SAR data (including CPU averages)
- Email it using the local mail service
Optional: Automate with Cron
You can automate this report daily by adding it to your crontab:
crontab -e
Add a line like this to send it every day at 11:00 PM:
0 23 * * * sar -A | mail -s "Daily SAR output" [email protected]