View CPU Usage $sar-Ueg: $sar-U1 2[/home/weber#]sar-u1 2Linux2.6. *- A-generic-pae (Myvps) ./ -/ the_i686_ (1CPU) the:Geneva: -AM CPU%user%nice%system%iowait%steal%Idle the:Geneva:xxAM All0.00 0.00 0.50 0.00 0.00 99.50 the:Geneva: onAM All0.00 0.00 0.00 0.00 0.00 100.00The following two parameters indicate the frequency of the monitoring, such as 1 and 2 in the example, which is sampled once per second and sampled 2 times in total; View CPU average load $sar-Q1 2SAR designationAfter-Q, you can see the number of processes in the running queue, the process size on the system, the average load, etc.
view Memory View memory usage SAR designations-after R, you can see the memory usage status; $sar-R1 2 the: ,: -AM kbmemfree kbmemused%memused kbbuffers kbcached kbcommit%Commit kbactive Kbinact the: ,: theAm17888 359784 95.26 37796 73272 507004 65.42 137400 150764 the: ,: -Am17888 359784 95.26 37796 73272 507004 65.42 137400 150764Average:17888 359784 95.26 37796 73272 507004 65.42 137400 150764View Memory usage $free-M
--sh -h is humanized display S is the size of the recursive entire directory to view the sorted size of all folders under this directory for in do du-sh $i; | -sh ' ls '
integrated applications when SAR is not available in the system, the following tools can be used instead: Linux has vmstat, UNIX systems have Prstateg: View CPU, Memory, usage: vmstat N m (n is the monitoring frequency, M is the number of monitors) [/home/weber#]vmstat1 3procs-----------Memory-------------Swap-------io-----system------CPU----r b swpd free buff cache si so bi boinchCS US sy ID WA0 0 86560 42300 9752 63556 0 1 1 1 0 0 0 0 About 01 0 86560 39936 9764 63544 0 0 0 the the the 5 0 the 00 0 86560 42168 9772 63556 0 0 0 - 127 231 - 2 - 0Use the Watch tool to monitor changes when a data change is required for a continuous monitoring application, the Watch tool meets the requirements, and after the watch command is executed, it enters an interface to output the currently monitored data, which is highlighted when the data changes; eg: when working with Redis , monitor memory changes: $watch-d-n1 './REDIS-CLI Info | grep memory'(The following is the interface content in the Watch tool, once the memory changes, that is, the real-time highlighting changes) every1.0s:./redis-cli info | grep memory Mon APR - -:Ten: $ theused_memory:45157376Used_memory_human:43.07MUsed_memory_rss:47628288Used_memory_peak:49686080Used_memory_peak_human:47.38M
Linux System performance Monitoring