Vmstat command to monitor Linux resources and visualize data graphically

Source: Internet
Author: User

I. VMSTAT BASIC knowledge

Vmstat can view system resource usage in real time, such as CPU, mem, IO, etc.

procs
RColumn represents run and waitCPU time slices The number of processes, if long-term greater than1, descriptionCPU shortage, need to increaseCpu.
BColumn represents the number of processes waiting on a resource, such as waiting forI/O, or memory exchange, etc.
CPU representsCPUto make it use state
usColumn shows how the user has spentCpuThe percentage of time.When the value of us is higher, the user process consumesCPU time is much, but if it is longer than50%, you need to consider optimizing the user's program.
SyColumn shows what the kernel process spendsThe percentage of CPU time. Over hereThe reference value for us + sy is80%, ifUs+syGreater than80% description may existInsufficient CPU.
WaColumn shows theIO waits for the occupiedThe percentage of CPU time. Over hereThe reference value for WA is30%, ifWA over30%, descriptionIO latency is severe, which can be caused by a large amount of random access to the disk, or by the bandwidth bottleneck of the disk or disk access controller.(Mostly block operations)。
IdColumn shows thePercentage of time that the CPU is in idle state
SystemShows the number of interrupts that occurred during the acquisition interval
InchColumn represents the number of device interrupts per second observed in a time interval.
The CS column represents the number of context switches produced per second, such as whenCsthan disk/ oand network packet rates are much higher and should be investigated further.
Memory
SwpdThe amount of memory switched to the memory swap area(k indicates)。 IfThe value of SWPD is not0, or bigger, like more than100m, as long asSiThe value of so is long0, system performance is still normal
FreeAmount of memory in the current free page list(k indicates)
BuffAsBuffer caches the amount of memory, generally read and write to the block device needs to be buffered.
CacheAsThe amount of memory in page cache, which is generally used as the file systemCache, ifThe cache is large, indicating thatCache file is more, if thisIn IOBi is relatively small, which indicates that the file system is more efficient. 
swap
si  the number of memory-swapping areas that were entered into memory.
so The amount of memory entered by the memory swap area.  
io
bi  the total amount of data read from the block device (read disk) (kb).
bo  block device writes the total amount of data (write disk) (kb)
Here we set the bi+bo reference value 1000, if more than 1000, and wa value should consider balancing the disk load, can be combined with iostat output to analyze.

Two: Vmstat use method

Vmstat Help:

Generally the most commonly used is Vmstat t means to collect data once every interval of time, and T is in seconds.

If you want to collect for a while and fix the number of acquisitions, use Vmstat T count where count indicates the number of times to collect.

More commonly used is to export the collected files to a file, such as will be collected every 5 seconds, a total of 100 times the data output to file resource.txt file, with Vmstat 5 > Resource.txt can be.

Three: Vmstat output data file processing

In the data file generated by the Vmstat command, each column of data is separated by a space, as shown in:

To make it easier to display these files in an Excel table, you need to replace the spaces in the data with other characters before processing.

In this article, replace the space with a comma, the vmstat generated file with the VI Editor open, enter : 1, $s//+/,/g, enter, you can replace the space with a comma.

Save the replaced file and download it and save it as a . csv file that you can open in Excel for processing.

In fact, you can also vmstat the generated data file, open directly in Excel, open when you select the separator symbol as "space", as shown, the same method in Excel processing.

"Data processing trivia"Vmstat monitor the data that is output to a file, after every 20 lines, there are new header rows that, when imported into Excel, need to be deleted when they are processed, and can be deleted using the sed command.

After processing:

Vmstat command to monitor Linux resources and visualize data graphically

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.