Vmstat

From DikapediaV2
Revision as of 14:36, 11 September 2024 by Ardika Sulistija (talk | contribs) (Created page with "Add notes: https://www.linode.com/docs/guides/use-vmstat-to-monitor-system-performance/ Add, by default it shows in <b>Kilobytes</b>!!! <b>vmstat</b> - Report virtual memory statistics. $ vmstat 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 272904 0 235736 0 0 1 3 12 22 0 0 100 0 0 $ vmstat 1 5 procs -----...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Add notes: https://www.linode.com/docs/guides/use-vmstat-to-monitor-system-performance/

Add, by default it shows in Kilobytes!!!

vmstat - Report virtual memory statistics.


$ vmstat
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 272904      0 235736    0    0     1     3   12   22  0  0 100  0  0


$ vmstat 1 5
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 388256   2088 319304    0    0  9550    34  192  220  4  0 87  8  0
 0  0      0 388248   2088 319304    0    0     0     0   55  120  0  0 100  0  0
 0  0      0 388248   2088 319304    0    0     0     0   62  128  0  0 100  0  0
 0  0      0 388248   2088 319304    0    0     0     0   70  135  0  0 100  0  0
 0  0      0 388248   2088 319304    0    0     0     0   68  128  0  0 100  0  0
  • Print 5 times, every 1 second


$ vmstat -S M
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    378      2    311    0    0  9475    34  191  219  4  0 87  8  0
  • -S = requires k, K, m or M (default is KiB)


How to run vmstat continuously


This is good if you want to monitor free memory continuously.

$ vmstat -S M 2 -t
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- -----timestamp-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st                 UTC
 0  0      0    542      1    317    0    0   842  5892  649 1104 18  5 69  3  5 2023-08-28 16:30:04
 0  0      0    542      1    317    0    0     0     0   30   49  0  0 100  0  0 2023-08-28 16:30:06
 0  0      0    542      1    317    0    0     0     0   27   48  0  0 100  0  0 2023-08-28 16:30:08
 0  0      0    542      1    317    0    0     0     0   27   47  0  0 100  0  0 2023-08-28 16:30:10
 0  0      0    542      1    317    0    0     0     0   27   48  0  0 100  0  0 2023-08-28 16:30:12
 0  0      0    542      1    317    0    0     0     6   32   52  0  0 100  0  0 2023-08-28 16:30:14
  • -S = Size is in MB
  • 2 = print every 2 sec
  • -t = include timestamp





References: [+] https://www.cyberciti.biz/faq/linux-check-memory-usage/