Sunday, 11 March 2012

Server Monitoring using vmstat

iostat / vmstat / mpstat are some tools to monitor server performance. 

 * iostat reports CPU, disk I/O, and NFS statistics.

 * vmstat reports virtual memory statistics.

 *  mpstat reports processors statictics.

 # vmstat

 procs -----------memory-----------------          ---swap-- ------io---- ---system-- -----cpu--
 r  b    swpd     free     buff        cache   si   so    bi    bo   in   cs us sy id wa st
 1  0  196112  75232 151884 611352   0    0     8     91   45   40 20  9 71  0  0

 vmstat output contains the following fields:

    Procs – r: Total number of processes waiting to run
    Procs – b: Total number of busy processes
    Memory – swpd: Used virtual memory
    Memory – free: Free virtual memory
    Memory – buff: Memory used as buffers
    Memory – cache: Memory used as cache.
    Swap – si: Memory swapped from disk (for every second)
    Swap – so: Memory swapped to disk (for every second)
    IO – bi:  Blocks in. i.e blocks received from device (for every second)
    IO – bo:  Blocks out. i.e blocks sent to the device (for every second)
    System –  in: Interrupts per second
    System –  cs: Context switches
    CPU – us, sy, id, wa, st: CPU user time, system time, idle time, wait time

Display active and inactive memory
# 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  196112  75236 224864  787620    0    0     8    91   45   41 20  9 71  0  0

Display number of forks since last boot

This displays all the fork system calls made by the system since the last boot.

  # vmstat -f
       500235 forks  

Execute Every x seconds
# vmstat 2
# vmstat 2 5

Display slab info
# vmstat -m

Display statistics in a table format
# vmstat -s

Display disk statistics
# vmstat -d

Display statistics for a partition
 # vmstat -p /dev/sda1

Display in MB
# vmstat -S m


No comments:

Post a Comment