Monday, December 12, 2016

How to Install and Configure sysstat Utils on RHEL 7

Overview

The System Activity Report or SAR report; collects, reports and save(s) CPU, Memory amp; I/O usages at regular intervals.

“sar” command supports generating different types of reports on fly and these reports can be exported as well. In this guide we will explain sar command execution with various attributes.

SAR will collate and give information about below;
  • Block Device Statistics
  • Paging Statistics
  • Swap Statistics
  • CPU Utilization Statistics
  • Memory Utilization Statistics
  • Interrupt Statistics
  • Network Statistics
  • Power Management Statistics
  • Report I/O Statistics
  • Report hugepages utilization statistics

SAR Package Installation

SAR package installation is simple and easy; to install the package follow the below steps.

Verify Installed Status

Before you install the package, check if the package is already installed, to know the package is already installed, run the command;

yum list installed sysstat



Install Package

After checking the package installation and you found that the package is not installed, to install the package run the command;

yum install sysstat -y -q && yum list installed sysstat -q



Enable Sysstat Service

After installation, ensure that the sysstat is enabled, so that it can startup automatically upon boot-up. To enable the service run the command;

systemctl enable sysstat



Start Sysstat Service

Next, you need to start the sysstat service to generate the reports, to start the command;

systemctl start sysstat && systemctl status sysstat -l


Stop Sysstat Service

In case you would like to stop the service run the command;

systemctl stop sysstat && systemctl status sysstat -l


Restart Sysstat Service

In case you would like to restart the service run the command;

systemctl restart sysstat && systemctl status sysstat -l


Check Sysstat Service Status

To check the sysstat service status, run the command;

systemctl status sysstat -l


Sysstat – Default Configuration

Sysstat can be configured as per the business need and disk availability on the server, to view the current configuration run the below command; Each attribute can be reconfigured as per the requirement of the business.

egrep -v '^#|^$|^;' /etc/sysconfig/sysstat




Attribute Default Purpose
HISTORY 28 Configure statistics data to be retained for day(s)
COMPRESSAFTER 31 Compress statistics data after day(s)
SADC_OPTIONS "-S DISK" Configure system activity diagnostics collector option
ZIP "bzip2" Compression command for compressing

Sysstat – Cron Job Configuration

After configuring the sysstat, next we should configure cron job to collect periodical and store “SAR” reports. To view current cron job, run the command below;

cat /etc/cron.d/sysstat

# Run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib64/sa/sa1 1 1
# 0 * * * * root /usr/lib64/sa/sa1 600 6 &
# Generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib64/sa/sa2 -A

Note: If the job is not configured, copy and paste the above snippet into new cron job.  

Package Binaries and Purpose

Package / Binary Purpose / Usage
sysstat To define the maximum no. of days to save SAR reports.
/usr/bin/sar Collect, report, or save system activity information.
/usr/bin/mpstat Report processors related statistics.
/usr/bin/sadf Display data collected by SAR in multiple formats.
/usr/lib64/sa Summarizes accounting information.
/usr/lib64/sa/sa1 Collect and store binary data in the system activity daily data file.
/usr/lib64/sa/sa2 Write a daily report in the “/var/log/sa” directory.
/usr/lib64/sa/sadc System activity data collector.
/usr/bin/cifsiostat Report CIFS statistics.
/usr/bin/nfsiostat Report input/output statistics for network filesystems (NFS).
/usr/bin/pidstat Report statistics for Linux tasks.
/usr/lib/systemd/system/sysstat.service Sysstat systemd management control file.


Slideshare Information

Step by step guide with screenshots is uploaded to slideshare.



No comments:

Post a Comment