This article is a mirror article of machine translation, please click here to jump to the original article.

View: 320|Reply: 0

[linux] sysstat tutorial for Linux system performance monitoring tools

[Copy link]
Posted on 2025-9-25 10:41:14 | | | |
Requirements: I bought a lightweight cloud server in Alibaba Cloud, sometimes the CPU is 100% and the remote cannot be connected, and I don't know what happened, and it returns to normal after restarting or waiting for a period of time. You can use sysstat to collect system conditions regularly (some images of Alibaba Cloud are already installed built-in).
Linux deploys the Netdata performance monitoring tool using Docker
https://www.itsvse.com/thread-10824-1-1.html

sysstat

Official Website:The hyperlink login is visible.
Source:The hyperlink login is visible.
Frequently asked questions:The hyperlink login is visible.

The sysstat software package contains a variety of utilities commonly used by commercial Unix to monitor system performance and usage activities:

  • iostat reports CPU stats and input/output statistics for block devices and partitions.
  • mpstat reports individual or combined processor-related statistics.
  • pidstat reports statistics for Linux tasks (processes): I/O, CPU, memory, etc.
  • tapestat reports statistics on tape drives connected to the system.
  • cifsiostat reports CIFS statistics.


Sysstat also contains tools that you can schedule via cron or systemd to collect and record the history of performance and activity data:

  • SAR collects, reports, and saves system activity information (see the list of metrics collected by SAR below).
  • SADC is a system activity data collector that serves as a backend for SAR.
  • SA1 collects binary data and stores it in a system activity daily data file. It is the frontend of SADC and is designed to run via cron or systemd.
  • SA2 generates a daily activity summary report. It is the frontend of SAR and is designed to run via cron or systemd.
  • SADF displays data collected by SAR in a variety of formats (CSV, XML, JSON, etc.) and can be used to exchange data with other programs. This command can also be used to graph the various activities collected by SAR using SVG (Scalable Vector Graphics) format.


The default sampling interval is 10 minutes, but of course it can be changed (it can be as small as 1 second).

Installation tutorial

In the case of Rocky Linux 9, the installation command is as follows:

Configuration file: /etc/sysconfig/sysstat
Collection frequency: systemctl cat sysstat-collect.timer
Collection directory: /var/log/sa

View specific metrics

CPU Usage:
sar -u -f /var/log/sa/sa05
Memory Usage:
sar -r -f /var/log/sa/sa05
Swap partition usage:
sar -S -f /var/log/sa/sa05
I/O Usage:
sar -b -f /var/log/sa/sa05
Network Interface Statistics (RX/TX):
sar -n DEV -f /var/log/sa/sa05
Context switching and process creation per second:
sar -w -f /var/log/sa/sa05



Use crontab to call pidstat to collect process information with the following command:

Note: YesWith logrotate cut logsOutline.

Reference:The hyperlink login is visible.




Previous:Stratum V1, V2 cryptocurrency network communicates with the pool protocol
Next:Git syncs the primary repository branch code to the private repository branch
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com