There are a lot of Linux server monitoring tools in the wild. They have strong and weak sides against others. To get more about Linux server monitoring dstat can be used.

Features of dstat are joining information from tools like vmstat, netstat, mpstat, displaying statistics simultaneously, list ordering, exporting to CSV.

How to Install dstat in Linux

dstat can be get from official ditributions repositories. In this tutorial we will use fedora but Ubuntu, Debian has same operations too.

$ sudo dnf install dstat -y

Installing is fast because it is small as 197k.

dstat Help

Quick help can be get with the -h parameter to the dstat command

$ dstat -h Usage: dstat [-afv] [options..] [delay [count]] Versatile tool for generating system resource statistics Dstat options: -c, --cpu enable cpu stats -C 0,3,total include cpu0, cpu3 and total -d, --disk enable disk stats -D total,hda include hda and total -g, --page enable page stats -i, --int enable interrupt stats -I 5,eth2 include int5 and interrupt used by eth2 -l, --load enable load stats -m, --mem enable memory stats -n, --net enable network stats -N eth1,total include eth1 and total -p, --proc enable process stats -r, --io enable io stats (I/O requests completed) -s, --swap enable swap stats -S swap1,total include swap1 and total -t, --time enable time/date output -T, --epoch enable time counter (seconds since epoch) -y, --sys enable system stats --aio enable aio stats --fs, --filesystem enable fs stats --ipc enable ipc stats --lock enable lock stats --raw enable raw stats --socket enable socket stats --tcp enable tcp stats --udp enable udp stats --unix enable unix stats --vm enable vm stats --vm-adv enable advanced vm stats --zones enable zoneinfo stats --list list all available plugins --plugin enable external plugin by name (see --list) -a, --all equals -cdngy (default) -f, --full automatically expand -C, -D, -I, -N and -S lists -v, --vmstat equals -pmgdsc -D total --bits force bits for values expressed in bytes --float force float values on screen --integer force integer values on screen --bw, --black-on-white change colors for white background terminal --color force colors --nocolor disable colors --noheaders disable repetitive headers --noupdate disable intermediate updates --output file write CSV output to file --profile show profiling statistics when exiting dstat delay is the delay in seconds between each update (default: 1) count is the number of updates to display before exiting (default: unlimited)

Running dstat

Running dstat without arguments gives we total cpu usage, dsk read/write, network send/receive, paging and interrupts.

$ dstat

Getting Memory Related Info with dstat

By providing --vmstat argument we can get information about memory related used, buffer, cache, read/write information like below.

As you see memory usage is very low and about 62M.

Get Top Process with dstat

dstat can get top process and memory using application with --top-cpu and --top-mem parameters.

$ dstat -c --top-cpu -dn --top-mem

As you see top CPU changes over time. Null entry means that dstat is top process.

Export From dstat to Csv

dstat entries can be exported to the CSV or similar formats. Here is an example that exports 5 entries in 1 second interval into poftut.csv

$ dstat --time --cpu --mem --load --output poftut.csv 1 5

$ less poftut.csv

List dstat Plugins

dstat has a lot of plugins to use like nfs, sm rpc info. To get full list use --list parameter.

$ dstat --list

Dstat- Monitor Linux Server Performance Infographic