Linux sar

sar

sar -h:sar的帮助命令

  1. [root@iZuligp6e1dyzfZ ~]# sar -h
  2. Usage: sar [ options ] [ <interval> [ <count> ] ]
  3. Main options and reports:
  4. -b I/O and transfer rate statistics
  5. -B Paging statistics
  6. -d Block device statistics
  7. -H Hugepages utilization statistics
  8. -I { <int> | SUM | ALL | XALL }
  9. Interrupts statistics
  10. -m { <keyword> [,...] | ALL }
  11. Power management statistics
  12. Keywords are:
  13. CPU CPU instantaneous clock frequency
  14. FAN Fans speed
  15. FREQ CPU average clock frequency
  16. IN Voltage inputs
  17. TEMP Devices temperature
  18. USB USB devices plugged into the system
  19. -n { <keyword> [,...] | ALL }
  20. Network statistics
  21. Keywords are:
  22. DEV Network interfaces
  23. EDEV Network interfaces (errors)
  24. NFS NFS client
  25. NFSD NFS server
  26. SOCK Sockets (v4)
  27. IP IP traffic (v4)
  28. EIP IP traffic (v4) (errors)
  29. ICMP ICMP traffic (v4)
  30. EICMP ICMP traffic (v4) (errors)
  31. TCP TCP traffic (v4)
  32. ETCP TCP traffic (v4) (errors)
  33. UDP UDP traffic (v4)
  34. SOCK6 Sockets (v6)
  35. IP6 IP traffic (v6)
  36. EIP6 IP traffic (v6) (errors)
  37. ICMP6 ICMP traffic (v6)
  38. EICMP6 ICMP traffic (v6) (errors)
  39. UDP6 UDP traffic (v6)
  40. -q Queue length and load average statistics
  41. -r Memory utilization statistics
  42. -R Memory statistics
  43. -S Swap space utilization statistics
  44. -u [ ALL ]
  45. CPU utilization statistics
  46. -v Kernel table statistics
  47. -w Task creation and system switching statistics
  48. -W Swapping statistics
  49. -y TTY device statistics

sar -u:CPU监控

[root@iZuligp6e1dyzfZ ~]# sar -u 10 3
Linux 3.10.0-514.26.2.el7.x86_64 (iZuligp6e1dyzfZ)      07/31/2020      _x86_64_        (1 CPU)

02:41:12 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
02:41:23 PM     all     60.87      0.00     39.13      0.00      0.00      0.00
02:41:33 PM     all     60.87      0.00     39.13      0.00      0.00      0.00
02:41:43 PM     all     51.85      0.00     48.15      0.00      0.00      0.00
Average:        all     57.53      0.00     42.47      0.00      0.00      0.00

sar -r:内存监控

[root@iZuligp6e1dyzfZ ~]# sar -r 10 3
Linux 3.10.0-514.26.2.el7.x86_64 (iZuligp6e1dyzfZ)      07/31/2020      _x86_64_        (1 CPU)

02:51:26 PM kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
02:51:36 PM     69672   1814052     96.30    148648    879688   1478656     78.50   1242540    385528       152
02:51:46 PM     69556   1814168     96.31    148648    879704   1478656     78.50   1242592    385528       128
02:51:56 PM     69284   1814440     96.32    148648    879728   1478656     78.50   1242892    385520       168
Average:        69504   1814220     96.31    148648    879707   1478656     78.50   1242675    385525       149

sar -b:I/O监控

[root@iZuligp6e1dyzfZ ~]# sar -b 10 3
Linux 3.10.0-514.26.2.el7.x86_64 (iZuligp6e1dyzfZ)      07/31/2020      _x86_64_        (1 CPU)

02:54:17 PM       tps      rtps      wtps   bread/s   bwrtn/s
02:54:27 PM    111.76      0.00    111.76      0.00   4800.00
02:54:37 PM    175.00      0.00    175.00      0.00   6114.29
02:54:47 PM    190.48      0.00    190.48      0.00   7314.29
Average:       153.01      0.00    153.01      0.00   5879.52

sar -w:系统SWAP监控

[root@iZuligp6e1dyzfZ ~]# sar -w 10 3
Linux 3.10.0-514.26.2.el7.x86_64 (iZuligp6e1dyzfZ)      07/31/2020      _x86_64_        (1 CPU)

02:55:06 PM    proc/s   cswch/s
02:55:16 PM     46.15  61788.46
02:55:26 PM     58.33  66933.33
02:55:36 PM     58.33  67225.00
Average:        54.05  65220.27