Sysstat system maintenance software introduction

xiaoxiao2021-03-06  18

The most commonly used tools in the IntroductionLinux / UNIX system is to observe service loads, such as CPU and memory usage, network usage, and disk write and read speed.

This package is installed, which generally includes several commands as follows.

SAR

iostat

SA1

SA2

Sadf

MPSTAT

SADC

sysstat

In these orders, some are services, some are the commands to view the results. There is also an instant server CPU, memory, and network usage.

For example, to open SA1 SA2 or SYSSTAT to use SAR SADF SADC

Also instant server's CPU, memory, network usage, such as: MPSTAT IOSTAT

Useage how to use this tool? If you want to see the command of the instant server's CPU, memory, network usage, such as MPSTAT IOSTAT, you can simply use the following command, if you are more complicated, you can use the man to view all commands.

such as:

[Beinan @ s11 beinan] $ ostat

Linux 2.4.22-2f (S11) October 30, 2004

AVG-CPU:% User% Nice% System% iowait% iDLE

8.64 0.00 0.95 0.00 90.41

Device: TPS BLK_READ / S BLK_WRTN / S BLK_READ BLK_WRTN

DEV3-0 2.97 55.28 38.84 213314 149856

[Beinan @ S11 Beinan] $ mpstat

Linux 2.4.22-2f (S11) October 30, 2004

03:13 56 seconds CPU% user% nice% sys% iowait% IRQ% SOFT% iDLE INTR / S

03 13 minutes 56 seconds All 8.56 0.00 0.94 0.00 0.00 0.00 90.50 84.32

For example, observe the disk's read and write speed:

[Beinan @ S11 Beinan] $ iostat -p

Linux 2.4.22-2f (S11) October 30, 2004

AVG-CPU:% User% Nice% System% iowait% iDLE

33.54 0.00 4.95 0.86 60.65

Device: TPS BLK_READ / S BLK_WRTN / S BLK_READ BLK_WRTN

HDA 26.26 186.57 481.17 16117015 41564960

HDA1 3.29 1.33 26.01 115138 2246456

HDA2 19.86 26.49 149.65 2288449 12927104

HDA3 40.16 158.57 305.51 13697580 26391400

HDA5 0.00 0.00 0.00 8 0

There are many options in each command, this requires us to practice, isn't it? ?

If you want the server to run automatically, you can have a data feedback every hour, we can use cron to make SA1 SA2, so there is a log file exists / var / log / sa / directory. We can run SAR when we arrive, you can know every hour of the past:

You can write a command to a file. . . Set this file to 755 execution permissions, put it in the /etc/cron.Hourly directory.

[root @ S11 root] # cd /etc/cron.Hourly/ Enter the directory

[root @ S11 cron.Hourly] # Touch Sa1ho creates files, this file name can be named

[root @ S11 cron.Hourly] # chmod 755 sa1ho then writes the following line in this file

/ usr / local / lib / sa / sa1 &

In this way, there is a log file writing / var / log / sa / directory, and of course there is a command of / usr / local / lib / sa / sa2, or write a file to / etc / cron In .Weekly / Directory, SA2 is doing? You first look at the help file, of course, you can also write /etc/cron.Hourly/, this is once every hour.

There is also a sysstat in the source package, you can test it into the /etc/init.d directory, and set good permissions and run the level, so sysstat can start itself. This is used to start the SADC, this command is used to read the log files in the / var / log / sa directory. As for detailed usage, unfamiliar brothers still look at MAN, or help documents. I don't quite understand what is used.

转载请注明原文地址:https://www.9cbs.com/read-45426.html

New Post(0)