Pages

Friday, June 23, 2017

Linux Performance Monitoring with Vmstat and Iostat Commands

This is our on-going series of commands and performance monitoring in LinuxVmstat and Iostat both commands are available on all major Unix-like (Linux/Unix/FreeBSD/Solaris) Operating Systems.
If vmstat and iostat commands are not available on your box, please install sysstat package. The vmstatsar and iostat commands are the collection of package included in sysstat – the system monitoring tools. The iostat generates reports of CPU & all device statistics. You may download and install sysstat using source tarball from link sysstat, but we recommend installing through YUM command.

Linux Vmstat and Iostat Commands
Linux Performance Monitoring with Vmstat and Iostat

Install Sysstat in Linux

# yum -y install sysstat
  1. vmstat – Summary information of MemoryProcessesPaging etc.
  2. iostat – Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions.
6 Vmstat Command Examples in Linux

1. List Active and Inactive Memory

In the below example, there are six columns. The significant of the columns are explained in man page of vmstat in details. Most important fields are free under memory and si, so under swap column.
[root@tecmint ~]# vmstat -a
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r  b   swpd   free  inact active   si   so    bi    bo   in   cs us sy id wa st
1  0      0 810420  97380  70628    0    0   115     4   89   79  1  6 90  3  0
    1. Free – Amount of free/idle memory spaces.
    2. si – Swaped in every second from disk in Kilo Bytes.
    3. so – Swaped out every second to disk in Kilo Bytes.
Note: If you run vmstat without parameters it’ll displays summary report since system boot.

2. Execute vmstat ‘X’ seconds and (‘N’number of times)

With this command, vmstat execute every two seconds and stop automatically after executing six intervals.
[root@tecmint ~]# vmstat 2 6
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
0  0      0 810420  22064 101368    0    0    56     3   50   57  0  3 95  2  0
0  0      0 810412  22064 101368    0    0     0     0   16   35  0  0 100  0  0
0  0      0 810412  22064 101368    0    0     0     0   14   35  0  0 100  0  0
0  0      0 810412  22064 101368    0    0     0     0   17   38  0  0 100  0  0
0  0      0 810412  22064 101368    0    0     0     0   17   35  0  0 100  0  0
0  0      0 810412  22064 101368    0    0     0     0   18   36  0  1 100  0  0

3. Vmstat with timestamps

vmstat command with -t parameter shows timestamps with every line printed as shown below.

      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
                                                    ► Read more: http://adf.ly/1n5xHO
      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

No comments:

Post a Comment