ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

How to convert an raw saXX file to human readable sar file so that it is kSar compatible?


Article ID: 167989


Updated On:




How to convert an raw saXX file to human readable sar file so that it is kSar compatible?


The /var/log/sa folder on APMs or CPMs contains the sarXX and saXX files, where XX is the day of the month.

The tool kSar helps convert the human readable sarXX files to a graphical format and even allows one to generate PDF's from the command line.

However, the saXX files are still in binary/raw format and are not human readable, thus cannot be processed by kSar.
The saXX file for the current day "rolls" over at the end of the day and generates a matching sarXX file that is human readable and kSar compatible.

There often times one wants to review the saXX for the current day within kSar.

In order to do this, one can simply use the following example when using the sar -A command to convert the format of the output using the LANG=C environment variable and redirect the output to a file.

[[email protected] admin]# LANG=C sar -A -f sa28 > sar28

The resulting output is kSar compatible.

Remember, you need to use sar on a system that has matching kernel version from where the saXX file was retrieved from.

In the example below, the CPM and the APM both have matching 2.6.18 base kernels, so the sar utility can read saXX files correctly in this case.

[[email protected] admin]# uname -a
Linux N7SVCXB003 2.6.18-53.el5_64smp #1 SMP Wed Aug 17 02:51:52 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux

vsx2_1 (N7SVCXB003): [vs0] ~# uname -a
Linux vsx2_1 2.6.18-53ElSalvador_smpxos #1 SMP Wed Aug 17 02:44:27 EDT 2011 i686 i686 i386 GNU/Linux


Example: One can crunch the sa28 from a system so that it is kSar compatible:

# LANG=C sar -A -f sa28 > sar28