Setting up a Linux server is only part of what must be done to run a solid site or service. You must also monitor the running system for security incidents, performance bottlenecks and resource use. While Linux exposes a host of monitoring capabilities, these are often very low-level and require a higher-level framework to effectively track. System Activity Reporter (SAR) is one such monitoring solution.
Getting Started with System Activity Reporter
When complete, you’ll be able to monitor this server’s performance, resource use and other characteristics.
We’ll begin by installing the Sysstat package. It will also be configured to launch on boot.
yum install sysstat -y
systemctl start sysstat.service
systemctl enable sysstat.service
Sysstat is now logging to /var/log/sa. It is now monitoring and reporting system activity and resource use.
Updates are performed via Cron, and reports persist for seven days. To change this value, tweak /etc/cron.d/sysstat.
As stated, logs are stored in /var/log/sa. sa20 is a log of system activity on the 20th of the month. If the 20th of this month has not yet passed, then it refers to the 20th of the previous month.
There are several useful SAR commands to access its data. Here, for instance, is how you’d view a daily report of memory and swap usage.
Or maybe you’d like to view a history of swap space use on the 10th of the current month.
sar -S -f /var/log/sa/sa10
Here is a current report of CPU statistics updated by the second.
sar -P ALL 1
This command reports on disk I/O statistics, updated every three seconds, for the next ten minutes.
sar -b 3 10
Now we’ll display the server’s load average history for today.
System Activity Reporter is great for both monitoring current server use, and for determining if performance issues exist. Running without a monitoring solution is a bad practice, as it will leave you unaware of serious server issues until it is too late. If this guide was helpful to you, kindly share it with others who may also be interested.