Ubuntu install sysstat

Ubuntu install sysstat

sudo apt install sysstat

Once installation completed, enable sysstat by setting the value to true.

sudo vim /etc/default/sysstat

ubuntu-install-sysstat-01

After that restart the sysstat service

sudo service sysstat restart

By default sysstat sample the CPU usage every 10 minutes at 5, 15, 25, 35, 45 and 55 minutes of the hour. To modify it,

sudo vim /etc/cron.d/sysstat

ubuntu-install-sysstat-02

Viewing the stats

To view latest stats

sar

To view yesterday’s stats

sar -f /var/log/sysstat/sa$(date +%d -d 'yesterday')

To view specific date stats

sar -f /var/log/sysstat/sa$(date +%d -d '2019-04-27')