LinuxCommandLibrary

sa2

Collect, report, and save system activity

SYNOPSIS

sa2 [ -A ] [ -B ] [ -d ] [ -H ] [ -j { SADF } ] [ -n { keyword [,...] } ] [ -N { keyword [,...] } ] [ -P { ALL | list } ] [ -r ] [ -S ] [ -u [ ALL ] ] [ -v ] [ -W ] [ -x { SADF } ] [ -y ] [ -z ] [ interval count ]

PARAMETERS

-A
    Same as specifying -bBdHlnqrSuvWwy. This option currently excludes -P and -j, -N, and -x options.

-B
    Report paging statistics.

-d
    Report activity for each block device.

-H
    Report hugepages utilization.

-j { SADF }
    Report statistics in JSON format. Possible values for SADF are SUMMARY, DETAIL, INTERFACES, DISKS, and ALL.

-n { keyword [,...] }
    Report network statistics. Keywords are DEV, EDEV, NFS, NFSD, SOCK, IP, EIP, TCP, ETCP, UDP, and ICMP.

-N { keyword [,...] }
    Report network statistics using the specified network device(s). Possible values for keyword are DEV, EDEV, NFS, NFSD, SOCK, IP, EIP, TCP, ETCP, UDP, ICMP and ALL.

-P { ALL | list }
    Report per-processor statistics for the processor or processors specified in list. Specifying ALL reports statistics for each individual processor and globally for all processors.

-r
    Report memory statistics.

-S
    Report swap space utilization statistics.

-u [ ALL ]
    Report CPU utilization. The ALL keyword reports additional CPU fields.

-v
    Report inode, file and other kernel table status.

-W
    Report swapping statistics.

-x { SADF }
    Report statistics in XML format. Possible values for SADF are SUMMARY, DETAIL, INTERFACES, DISKS, and ALL.

-y
    Report TTY device activity.

-z
    Instruct sar to display statistics using power of 1024. The -z option is used in conjunction with the -b option.

interval
    Sampling interval in seconds.

count
    Number of times to sample. If omitted, sa2 will loop forever.

DESCRIPTION

The sa2 command is a shell script used by sar to collect and store system activity information in binary data files.

It's typically run as a cron job to periodically sample system metrics like CPU usage, memory utilization, disk I/O, network activity, and more. The collected data is then used by sar to generate reports, allowing administrators to analyze system performance over time.

Unlike sar which provides immediate reports, sa2 focuses on data gathering for later analysis. This provides a historical record of system activity.

sa2 is crucial for capacity planning, identifying performance bottlenecks, and troubleshooting system issues. Without sa2, the sar command is limited to displaying only current activity since the last system reboot. It is intended to be launched from cron for periodic execution.

CAVEATS

sa2 relies on cron to execute periodically. Incorrect cron configuration can lead to missing data or excessive system load.

Ensure sufficient disk space for the data files it creates to avoid filling up the filesystem. These files can grow significantly over time.

CONFIGURATION

The standard location for the cron job configuration is typically /etc/cron.d/sysstat. The exact path can vary based on the Linux distribution.

DATA STORAGE

The collected data is stored in binary files located in /var/log/sa. The files are named saDD, where DD is the day of the month. Each day has its dedicated file.

HISTORY

sa2 is part of the sysstat package, which has been actively developed and maintained for many years.

Its origins trace back to early Unix systems, where tools for system monitoring and reporting were essential for managing server infrastructure. Over time, sa2 and the associated tools have evolved to support new hardware, kernel features, and monitoring requirements.

SEE ALSO

sar(1), sadc(8), sa1(8)

Copied to clipboard