When you first run sar
after installing sysstat, you might encounter:
Cannot open /var/log/sa/sa21: No such file or directory
Please check if data collecting is enabled
This indicates the system activity data collector service isn't running. Let's fix this properly.
On modern Linux systems using systemd, check the service status:
sudo systemctl status sysstat
sudo systemctl status sysstat-collect
If inactive, you'll need to enable the data collection.
For most distributions, edit the main configuration file:
sudo nano /etc/default/sysstat
Change this line to enable collection:
ENABLED="true"
Then restart the services:
sudo systemctl enable --now sysstat
sudo systemctl enable --now sysstat-collect
Wait 10 minutes (default collection interval) then check:
ls /var/log/sa/
You should see new saXX
files where XX is the day of month.
To modify collection intervals, edit /etc/sysstat/sysstat
:
# Activity interval in seconds
SADC_OPTIONS="-S XALL 10 6"
This changes collection to every 10 seconds with 6 samples per file.
To view today's CPU statistics:
sar -u
For memory usage:
sar -r
For a specific day's data (e.g., day 15):
sar -u -f /var/log/sa/sa15
If files still aren't appearing:
# Check for errors in journal
journalctl -u sysstat --since "1 hour ago"
# Verify cron job (older systems)
ls /etc/cron.d/sysstat
Remember that data collection begins after service restart, not retroactively.
When you first install the sysstat
package on Linux distributions like Manjaro and run sar
, you'll likely encounter:
Cannot open /var/log/sa/sa21: No such file or directory
Please check if data collecting is enabled
The sysstat package collects system activity data through a background service called sadc
(system activity data collector). By default on many distros, this service isn't automatically enabled after installation.
Verify if data collection is active with:
systemctl status sysstat
# Or for older systems:
service sysstat status
You should see either "active (running)" or "inactive (dead)" in the output.
For systemd-based systems (most modern distros):
sudo systemctl enable sysstat
sudo systemctl start sysstat
For legacy init systems:
sudo service sysstat start
sudo chkconfig sysstat on # For RedHat-based systems
The main configuration file /etc/sysstat/sysstat
controls data collection. Key parameters:
# Enable collection (1=yes)
ENABLED="1"
# How long to keep daily data (days)
HISTORY=28
# Compression of older files
COMPRESSAFTER=31
After enabling, wait 10 minutes (default collection interval) then check:
ls -l /var/log/sa/
sar -u # Should show CPU usage data
To modify the 10-minute default, edit the cron job at /etc/cron.d/sysstat
:
# Run every 2 minutes example
*/2 * * * * root /usr/lib64/sa/sa1 1 1
If issues persist:
- Check directory permissions:
sudo chmod 755 /var/log/sa
- Verify package installation:
pacman -Q sysstat
- View sysstat logs:
journalctl -u sysstat