Continuing with the objective 200.1 for the LPIC-2 117-201 exam we learn how to monitor our Linux system with tools from the package sysstat. Will will install sysstat on our Raspberry Pi and learn to use tools like iostat and mpstat that are included with the package. the main process to look at the data collection on the sar tool.
When enabled cron will collect data via an sa1 script every 10 minutes and write to /var/log/sa/sa<daynumber> or on Debian based systems like Ubuntu and the Pi /var/log/sysstat/sa<daynumber>. The sa2 script is deigned to create the summary data.
The amount of logs maintained can be controlled via the HISTORY directive in the file:
/etc/sysstat/sysstat (Debian) /etc/sysconfig/sysstat (Red Hat)
If more than 28 is specified then sub directories for the months will be created.
Before the log files are initialized we can read data with
sar -u 1 1
To read CPU activity
sar -q 1 1
To read load average information. Without the interval and count that data would be read from the day file that matches the current data or the specified date file
sar -q (current day) sar -q -f /var/log/sysstat/sa1 (from the first of the month)