How to install dstat on Ubuntu 16.04

To install dstat on Ubuntu 16.04

dstat is a versatile tool for generating system resource statistics and replacement for vmstat, iostat, netstat, and ifstat. You can additionally monitor MySQL database activity, batter percentage info for laptop, number of dbus connections, fan speed, nfs utility, postfix, system temperature sensors, power usage, etc,., more & more. Dstat is packed with several powerful features and some of them are listed as follows. 

 

dstat features

  • Combines vmstat, iostat, ifstat, netstat information and more
  • Shows stats in exactly the same timeframe
  • Enable/order counters as they make most sense during analysis/troubleshooting
  • Modular design
  • Written in python so easily extendable for the task at hand
  • Easy to extend, add your own counters (please contribute those)
  • Includes many external plugins to show how easy it is to add counters
  • Can summarize grouped block/network devices and give total numbers
  • Can show interrupts per device
  • Very accurate timeframes, no timeshifts when system is stressed
  • Shows exact units and limits conversion mistakes
  • Indicate different units with different colors
  • Show intermediate results when delay > 1
  • Allows to export CSV output, which can be imported in Gnumeric and Excel to make graphs

It is so simple to install dstat on Ubuntu 16.04, and this tutorial covers the ground on the same process. 

 

Installing dstat 

First, make sure you update your system by making use of the following command. 

root@linuxhelp:~# apt-get update
Hit:1 http://in.archive.ubuntu.com/ubuntu xenial InRelease          
Hit:2 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease
.
.
Fetched 5,469 kB in 20s (264 kB/s)                                                            
Reading package lists... Done

 

Once it is done, you shall install dstat by making use of the following command.

root@linuxhelp:~# apt-get install dstat
Reading package lists... Done
.
.
bingwallpaper
Reading package lists... Done

dstat has been installed. Here are some of its usages. 


dstat Usage
Here is a small gist of the options used with dstat - cdngy
c : cpu : Total cpu usage
d : disk : Disk Utilization
n : net : Total Network usage
g : page : page stats
y : sys : system stats

 

After successful installation of dstat, simply fire dstat without any option, the application will get opened.

root@linuxhelp:~#dstat

DSTAT

 

To show detailed information about Memory (used, buffer, cache & free), Swap (used & free) & Virtual Memory (allocated, free, major page fault & minor page fault) usage, run the following command.

 root@linuxhelp:~#dstat --mem --swap –vm

VM

 

To show detailed information about each CPU (including cpu0, cpu1, etc) and total usage run the command given below. It displays each CPU (user time, system time, idle time, steal time & wait time) process activity.

root@linuxhelp:~#dstat -C 0,1,2,total

TOTAL

 

To show detailed information about disk utilization (read & write) and disk I/O (read & write) utilization for particular disk run the below command. If you want to check total disk utilization & I/O, use dstat --disk --io.

root@linuxhelp:~#dstat --disk --io -D sda

SDA

 

You can display detailed information about network utilization (data receive and data send) for particular Ethernet make sure you run the following command. If you want to show all the Ethernet utilization, use dstat –net as follows. 

root@linuxhelp:~# dstat --net -N ens33

ENS33
 

 

You can also have detailed information about top CPU, top cputime (process using the most CPU time (in ms)), top disk I/O activity, top disk block I/O activity, top memory and top latency usage.

root@linuxhelp:~#dstat --top-cpu --top-cputime --top-io --top-bio --top-mem --top-latency

LATENCY
 

To show detailed information about (CPU, Disk, Memory, Process, Load & network) usage, which is very common for basic troubleshooting when server load is too high, make use of the following command.

root@linuxhelp:~#dstat --cpu --mem --proc --load --disk –net

NET

 

To show detailed information about tcp (listen, established, syn, time_wait, close), udp (listen, active) and socket (total, tcp, udp, raw, ip-fragments) usage, you need to run the following command.

root@linuxhelp:~#dstat --tcp --udp –socket


socket

 

Also, you can display statistic with every 5 seconds delay instead of default (1 sec delay) with any combination as per your requirement. The below combination shows about CPU and process statistic every 5 seconds. 

root@linuxhelp:~#dstat --time --cpu --proc 5


default

 

 

By default, delay is 1 sec and count is unlimited and if you want to display statistic every 2 seconds delay with 10 counts on any combination as per your requirement. The below combination shows about cpu & process statistic every 2 seconds with 10 counts.

root@linuxhelp:~#dstat --time --cpu --proc 2 10


delay

 

If you want to store the reports to file for further investigation, you can do by using the below format with any combination.

root@linuxhelp:~#dstat --output /opt/dstat-output.csv --cpu --mem --disk –io


file

 

See the output.CSV file date.

output
With this, the installation and usage of dstat on Ubuntu 16.04 gets completed. 
 


Thank you! for using Linux Help.

You find this tutorial helpful? Share with your friends to keep it alive.
For more help topics browse our website www.linuxhelp.com
Be the first to comment, we value your suggestions. For further queries please comment below.

Tags: dstat Ubuntu
user image Author :  Liam