The utility sar is part of the sysstat package. Note the double ‘s’. Most articles/documentation state that the jobs should be run using cron. On Raspbian buster and Ubuntu 22.04 this no longer works, the utilities work, but the historical database is not collected nor stored. These systems require that systemd run the collector.
Here’s how I now install sar on Raspbian buster & Ubuntu 22.04
apt-get install sysstat
then configure the package to collect & store the metrics
dpkg-reconfigure sysstat; # answer Yes to the question
then enable and start the service
systemctl enable sysstat; systemctl start sysstat; systemctl enable sysstat-collect.timer; systemctl start sysstat-collect.timer; systemctl enable sysstat-summary.timer; systemctl start sysstat-summary.timer;
TBH I am not sure if the timers need to be started, but it doesn’t seem to do any harm.
Now, sar will collect the stats and record them in its database. This is held in /var/log/sysstat, which is different from other documentation sources and the collector configuration parameters are held /etc/sysstat/sysstat.
I got all this from one answer at AskUbuntu written by Yvan. Thank you for this.
This has a short link of https://wp.me/pauVx4-1Oz