The last time we met we explored three basic tools to monitor the server status. Now it's time to look at several more advanced tools.
vmstat
The vmstat tool is used to periodically display information about the number of running and blocked processes, the internal memory status, paging, input/output operations, number of switching and interrupts, and CPU usage. This tool is not a standard part of the core system (most distributions contain it in the basic installation, however) and is included in the procps package.
The vmstat monitoring tool reads information from the corresponding v / proc files. Two values can be used as parameters. The first defines the delay between each listing and the second defines the overall number of listings. You can enter them after the -n switch:
$ vmstat -n 1 8
procs ————–memory————– –swap– –io– -system- ——-cpu——-
r b swpd free buff cache si so bi bo in cs us sy id wa
1 0 0 2075320 133552 1161112 0 0 12 21 50 71 5 1 94 0
0 0 0 2076148 133552 1161112 0 0 0 0 250 219 5 2 93 0
0 0 0 2076164 133560 1161108 0 0 0 68 56 122 0 0 99 1
1 0 0 2009268 133560 1177544 0 0 0 0 323 181 15 7 78 0
0 0 0 2018496 133560 1177496 0 0 0 0 171 128 5 1 94 0
0 0 0 2020728 133560 1177504 0 0 0 0 74 129 0 0 100 0
0 0 0 2020728 133560 1177504 0 0 0 0 57 114 0 0 100 0
2 0 0 2020768 133568 1177496 0 0 0 124 392 520 24 2 74 0
The first column (r) contains the number of processes ready to run; the second one (b) contains the number of blocked processes. The swpd column contains information about swap usage, memory usage, swap content analysis and additional information about disk and CPU usage.
iostat
The iostat tool is used to monitor input and output device activity.
$ iostat
Linux 3.2.0-49-generic (gnu.cz) 21.7.2013 _x86_64_(3 CPU)
avg-cpu: |
%user |
%nice |
%system |
%iowait |
%steal |
%idle |
|
4.60 |
0.00 |
1.09 |
0.49 |
0.00 |
93.82 |
|
Device: |
tps |
kB_read/s |
kB_wrtn/s |
kB_read |
kB_wrtn |
|
vda |
5,39 |
35,69 |
62,38 |
996573 |
1741776 |
The utility output is transparent. The first line contains information about the system (core version, platform), the next one contains information about CPU usage and the last one displays file system usage/activity.
Both vmstat and iostat are more advanced but quite essential tools with which to manage a GNU/Linux server. We’ll get back to other monitoring tools later.
Author: Jirka Dvořák