In this video, you will learn about SAR, the System Activity Reporter. It shows system
usage statistics that have been gathered over a longer period of time. And SAR is relevant
because a utility like TOP will only show you what is happening here and now. And the
best thing TOP can do is show you the last 1, 5 and 15 minute system usage averages.
SAR can gather information about everything and it gives you long-term trends on the utilization
of your computer. Now, these statistics are collected by the SA1 and SA2 programs and
they are executed as scheduled jobs, either using CROM or system D timers. And to work
with SAR, you need to verify that data gathering by these utilities is enabled. Let me show
you. So to start with, I need to install the SysTat package. Here on the CentOS system,
I'm using sudo dnf install –y systat. Next, when I'm using SAR with one of the many options
like SAR-A, what do we see? Oh no, we see cannot open VARLOG SA-SA30, no search file
or directory. Why is that? Well, that is because I've just installed the package, but in order
to work with SAR, you need to do some data gathering. So let me use systemctl listunit
files –d timers so that you can see all the system D timers and there we can see that
there is the SysTat collect timer. And SysTat collect timer is what we need here. You can
see it's enabled, but it's a scheduled job. And as a scheduled job, you will always need
to wait for a little bit. But if we use systemctl cat on systat collect.service, that is the
program that is triggered by the timer. There we can see what it is doing. So this is the
command that it is running. So you know what I'm going to do? I'm going to run it manually
using sudo because we need sudo privileges to do so. And here it is going to run. And
then I'm going to wait for one minute. So the minute is over, and I'm going to run
my data gatherer again. Now, why do I do that? Let me show you. I'm doing this because in
the var log directory, it should have created the SA directory. And in this SA directory,
we can see the file SA30. Why is that SA30? Well, because today is the 30th. And in the
SA30 file, we are able to find the data that has been gathered. So this is just a one-time
data gathering. It's only four kilobytes, but it's only just starting. And the result is that
right now I can use SAR minus A, and SAR minus A is giving me all the information. And that
includes CPU utilization. It includes network interface utilization. It includes storage
device utilization, and so much more. Now, as you can see, the first time I've used my data
gathering, it has created the header lines. It didn't really write any data. Only the second
time, it has written any data to it. And next, when this is growing a little bit and you get
more information, use SAR with one of the many, many commands that are available. Like, for
instance, SAR minus R all, which is doing what? Which is giving memory utilization statistics. I
would say knock yourself out in SAR minus minus L with all the different options that you can
request here. Every single aspect of system utilization can be queried. And when multiple
datasets have been gathered, you see a nice list. And the thing in this nice list is that you can
see an average. And the average, well, based on one-time data gathering is not so very exciting.
The exciting part is that you can see trends. So if you suspect your server to peak every night at
2am, well, SAR is going to reveal it. And that is what makes this utility so incredibly useful.