系统诊断
系统启动异常诊断 - dmesg。
查看系统活动信息 - sar。
[root ~]# sar -u -r 5 10
Linux 3.10.0-957.10.1.el7.x86_64 (izwz97tbgo9lkabnat2lo8z) 06/02/2019 _x86_64_ (2 CPU)
06:48:30 PM CPU %user %nice %system %iowait %steal %idle
06:48:35 PM all 0.10 0.00 0.10 0.00 0.00 99.80
06:48:30 PM kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty
06:48:35 PM 1772012 2108392 54.33 102816 1634528 784940 20.23 793328 1164704 0
-A
- 显示所有设备(CPU、内存、磁盘)的运行状况。-u
- 显示所有CPU的负载情况。-d
- 显示所有磁盘的使用情况。-r
- 显示内存的使用情况。-n
- 显示网络运行状态。
查看内存使用情况 - free。
[root ~]# free
total used free shared buff/cache available
Mem: 1016168 323924 190452 356 501792 531800
Swap: 0 0 0
虚拟内存统计 - vmstat。
[root ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
2 0 0 204020 79036 667532 0 0 5 18 101 58 1 0 99 0 0
CPU信息统计 - mpstat。
[root ~]# mpstat
Linux 3.10.0-957.5.1.el7.x86_64 (iZ8vba0s66jjlfmo601w4xZ) 05/30/2019 _x86_64_ (1 CPU)
01:51:54 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
01:51:54 AM all 0.71 0.00 0.17 0.04 0.00 0.00 0.00 0.00 0.00 99.07
查看进程使用内存状况 - pmap。
[root ~]# ps
PID TTY TIME CMD
4581 pts/0 00:00:00 bash
5664 pts/0 00:00:00 ps
[root ~]# pmap 4581
4581: -bash
0000000000400000 884K r-x-- bash
00000000006dc000 4K r---- bash
00000000006dd000 36K rw--- bash
00000000006e6000 24K rw--- [ anon ]
0000000001de0000 400K rw--- [ anon ]
00007f82fe805000 48K r-x-- libnss_files-2.17.so
00007f82fe811000 2044K ----- libnss_files-2.17.so
...
报告设备CPU和I/O统计信息 - iostat。
[root ~]# iostat
Linux 3.10.0-693.11.1.el7.x86_64 (iZwz97tbgo9lkabnat2lo8Z) 06/26/2018 _x86_64_ (1 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.79 0.00 0.20 0.04 0.00 98.97
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
vda 0.85 6.78 21.32 2106565 6623024
vdb 0.00 0.01 0.00 2088 0
显示所有PCI设备 - lspci。
[root ~]# lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Red Hat, Inc. Virtio network device
00:04.0 Communication controller: Red Hat, Inc. Virtio console
00:05.0 SCSI storage controller: Red Hat, Inc. Virtio block device
00:06.0 SCSI storage controller: Red Hat, Inc. Virtio block device
00:07.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon
显示进程间通信设施的状态 - ipcs。
[root ~]# ipcs
------ Message Queues --------
key msqid owner perms used-bytes messages
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
------ Semaphore Arrays --------
key semid owner perms nsems