Linux Commands

How to Use Ksar on Linux

SAR is a well-known command-line utility that is sometimes underestimated. Whenever you encounter performance problems, it delivers a huge amount of information. It just delivers long tables of numerical facts that are difficult to comprehend on their own. SAR generates output via the CLI. As a result, you must utilize kSar, a Java program that graphs all SAR data. So it allows you to export data to PDF, JPG, PNG, and CSV formats. You may import information from various sources: a local file, a local instruction, and a remote command through SSH. Because KSAR is based on Java, you ought to have JDK 11 or higher on the machine. One must explicitly obtain KSAR through SourceForge because it is not a component of the system’s repositories.

Firstly, you need to make your system up to date and power-packed to do all other tasks properly. We need to use our Ubuntu system’s everlasting “apt” module in the terminal shell query to update it. So, the terminal is launched using the “Ctrl+Alt+T.” After that, the command is executed as shown beneath the image, which properly updates our system and is ready to go.

Our system is ready to be used; we have to install the sysstat package. This sysstat package will make us see the system statistics on the terminal using the “SAR” command. So, the “apt-get” installation command will be executed with the sudo rights and the keyword “sysstat.” The password for the current account must be added to install it as below.

Now, the sysstat package has started downloading. It will continue to do so up to 100 percent.

The system’s configuration file for the sysstat package is at /etc/default/ folder. The system link has been added to start or add the service in our system and install it properly.

The installed version of SAR can now be seen in the terminal using the version command shown in the attached photo, i.e., sysstat 12.2.0.

After installing the sysstat utility, we need to change its main configuration file. We must set the sysstat utility “ENABLED” variable to “true” in this file. So, we have to open the configuration file for sysstat via the GNU Nano editor as below.

As shown below, we have to update the variable “ENABLED” to “true.” Save this file with “Ctrl+S” to apply the changes. After that, quit using the “Ctrl+X” shortcut.

After all this, we have to start and enable the sysstat service in our system using the “systemctl” command. The “start” and “enable” words are used for specified purposes.

To check if the sysstat service is enabled and actively running on our system, we need to utilize the systemctl command and the “status” keyword below. It is active, as shown.

Here comes the corn.d/sysstat file that will schedule the logs at specified intervals. So, we have to update the sysstat cron file using nano editor as demonstrated.

The log file will be generated after every 10 minutes by utilizing the below lines of settings. Add the below lines of settings in the code and save it to apply the updates.

Before further downloading, installing, and using kSar, we need to look at kSar command-line results for system statistics. Therefore, we have been utilizing the “SAR” command in the shell to check the Cpu utilization information on the shell.

The java must be installed before the installation of kSar in Ubuntu. So, we are going to install the openjdk version 11 on our system with the apt package. The sudo password will be required for this, as shown below. It has started the installation process.

The process of affirmation is required. So, we have added “y” to continue it.

We need to download the kSar zip file from the SourceForge website. Therefore, we went to the kSar page and tapped the Download button. The below dialogue box appeared on the screen. Select the “Save File” option and continue by tapping on the “OK” button.

The kSar zip file has started downloading in the Downloads folder of our system.

We have moved the downloaded file to the main home directory of our system, as listed below.

It’s time to unzip the kSar file in our system. So, we have been utilizing the “unzip” keyword command. It asks you to replace the license for it. Tap “A” for all to continue.

After unzipping the kSar archive, we need to navigate the unzipped folder using the “cd” query. And, we have listed all the items in the kSar folder using the “ls” query.

The “run.sh” file needs to be executed to run kSar in Ubuntu using the “sh” keyword.

We need to add the below command to get the statistics in kSar.

The image below will appear for 4 to 5 seconds as the kSar application starts.

The below kSar screen will be opened. You can start loading your file in it to see the graphs.

You can load any log file to display the graph from its Data option. Other options are also available to see the system statistics, i.e., SSH command, local command, etc.

The graph will contain some colored lines on the right panel of kSar. You can see the display.

Conclusion

We have covered the usage of the kSar java tool in Ubuntu 20.04 to make it easy for users to comprehend the system statistics via graphs. To understand kSar well, we have gone through the installation of the sysstat package in the system to understand “SAR.” The problem has been solved by updating some of the configuration files for sysstat. In the end, we have looked at the use of kSar. Therefore, our article contains a simple explanation for our users to download, install and use the kSar in Ubuntu 20.04 system within a few minutes and without any problem.

About the author

Saeed Raza

Hello geeks! I am here to guide you about your tech-related issues. My expertise revolves around Linux, Databases & Programming. Additionally, I am practicing law in Pakistan. Cheers to all of you.