Hello, friends. In this post, you will learn how to install Sar and Ksar on RHEL-based distributions. The procedure is easy. Let’s go.
Sar is a tool that allows you to obtain system information. It works similar to a monitoring tool with the great advantage of being easy and simple to use.
Some information you can get with Sar are:
- CPU utilization
- Memory paging and its utilization
- Network I/O, and transfer statistics
- Process creation activity
Let’s go for it.
Install Sar on RHEL-based distributions
Sar is present in the official repositories of RHEL and therefore of RHEL-based distributions like Rock Linux. So, first update the system
sudo dnf update
And then, install it by running
sudo dnf install sysstat
This will be enough, and you will be able to check the Sar version.
sysstat version 12.5.4 (C) Sebastien Godard (sysstat <at> orange.fr)
Sar is a system service, so we have to start it manually
sudo systemctl enable --now sysstat
By default, the frequency at which Sar monitors the system is 10 minutes. We can always modify it by running.
sudo systemctl edit sysstat-collect.timer
And in the
timer section, replace
10 with the number of minutes you want Sar to monitor.
Apply the changes by running
sudo systemctl daemon-reload
Now test Sar with some of its options.
sar 2 4
This indicates that it will refresh every 2 seconds and with four repetitions. This is just a test.
You will get an output like this
Now Sar is working.
Install KSar to get graphing from Sar
ksar is a sar graphing tool that can graph for now Linux, macOS and solaris sar output. sar statistics graph can be output to a PDF file. It requires Java, so you can use it on many operating systems.
So, download it from this link or by running
And then run it with the java command.
java -jar ksar-5.2.3-all.jar
You will see this screen
Then, we have to generate the data from the server where Sar is. To do this run.
LC_ALL=C sar -A > ~/sarfile
-A parameter indicates that it will collect all possible statistics. It will also place them in the user’s HOME directory, but you can use any other location.
Now with Ksar open, go to the
data menu, choose the Load from Text file option and select the file from its location.
You will see something like this
Now, in the Export menu you can generate the PDF which you can open with a desktop application
Monitoring is an important thing, and it always helps to have simple tools to get relevant information about how the system is doing.