w、vmstat、top、sar、nload
Others
2022-04-27 12:45:05
views: 0
10.1 Use w to view system load
- w/uptime view system load
- The first line: the current time, you can use date to view the system time, system startup time, currently logged in users, system load, one minute, five minutes, how many processes are using cpu activity in a unit time period within fifteen minutes (is one Average value) The value is related to the number of CPUs. The CPU here is a logical CPU, not a physical CPU. You can
# cat /peoc/cpuinfo
check the number of logical CPUs. The key field is processor. This number plus 1 is the number of logical CPUs. A physical CPU can have multiple cores, and each core can have multiple logical CPUs. w Check that the load average value is the most reasonable value of the logical cpu. The first value that is more concerned is the current system load value.
- The second line: user, login terminal, ip
- cat/proc/cpuinfo to view the number of cpu cores
- usage vmstat 1
- Related lines: r, b, swpd, si, so, bi, bo, us, wa
- top to view the resource usage of the process
- top -c view
10.2 The vmstat command
- If the cpu load value is high, use vmstat to view the cpu memory, virtual disk, swap partition,
- vmstat 1 1 second for the period, always showing the status
- vmstat 1 5 displays a total of 5 columns
- r: run indicates how many processes are in the run state
- b: block indicates that the process is blocked by conditions other than cpu, such as network speed, disk
- swpd: swap partition, when the memory is not enough, the data will be placed in the sweep partition, when there is a value, it means that the memory is not enough to use
- si: how many Kb data from sweep into memory
- so: How many Kb data are entered into sweep from memory
- bi: the amount of data coming out of disk and into memory
- bo: the amount of data written to disk
- us: User level, how much the user occupies, the number will not exceed 100, the value is a percentage, such as some services, if it is greater than 50 for a long time, it means that the CPU is tight
- sy: the percentage of CPU occupied by the system itself
- id: percentage of idle cpu
- us+sy+id = 100
- wa: wait waiting, similar to b, waiting for the cpu process
- Through this command, you can view the bottleneck of the system, cpu, disk
10.3 top command
- Top can view the specific process, dynamic display in 3 seconds
- The first line: same as w command
- The second line: statistics of the number of process information, the zombie process means that the main process ended unexpectedly, and the child process is not closed
- The third line: cpu information statistics, unit percentage, st means stolen cpu, such as when there is a virtual machine
- Fourth line: memory usage
- Fifth line: swap partition usage
- The sixth line: the default cpu usage is sorted from high to low; RES physical memory size unit Kb; uppercase M can be sorted by memory; P can be sorted by cpu; number 1, you can view a single cpu usage
- PID needs attention, kill PID can kill the process
- Press the letter q to exit the top command
- top -c can view the global path of the specific process command
- top -bn1 lists all processes at one time, suitable for use when writing scripts.
10.4 The sar command
- Without this package you need to install yum install -y sysstat
- Running sar directly calls a history file in the system by default. /var/log/sa is the path of this history file, which is generated every minute that is an integer multiple of 10. sa17 is a binary file, and sar17 can be opened.
- sar -n DEV NIC traffic
- sar -n DEV 1 10 is displayed every 1 minute, a total of 10 times
- The data packets accepted by rxpck/s, a few thousand is a normal value, if it is tens of thousands, it is an abnormal value
- Packets sent by txpck/s
- The amount of data accepted by rxkB/s
- The amount of data sent by txkB/s
- sar -q system load
- sar -b disk read and write
- sar -n DEV -f /var/log/sa/sa17 ends with a date, the contents of this directory are retained for a maximum of one month
10.5 nload command
- yum install epel-release
- yum install -y nload
- nload
- The first line is the name of the network card, ip, and the arrow keys switch the network card
Origin http://43.154.161.224:23101/article/api/json?id=325620979&siteId=291194637