Using dstat for monitoring CPU, Memory, Disk, etc

Overview

dstat is a good tool for replacing vmstat, netstat, iostat, and ifstat.  It it a very lightweight tool that can consolidate and correlate data  that  you would normally have to capture in different terminals.

 

Examples

 

RMAN Backup Throughput

I’ve used dstat before in the past to monitor backup throughput over interfaces.  Of course, this is possible if the backups are going to disk.

Run ifconfig to get the name of the interface you want to monitor.

Run dstat and watch the receive and send columns.

dstat -cn -N bond0.133 -C total -f 5

----total-cpu-usage---- net/bond0.1
usr sys idl wai hiq siq| recv  send
  6   7  83   4   0   0|   0     0
 11  40  44   5   0   0|1303k 1686k
 14  39  40   7   0   0|5295k 6131k
 11  36  47   6   0   0|1733k 3630k
 10  34  51   5   0   0|2334k   11M
  8  32  54   5   0   0|2189k   14M
  6  10  78   6   0   0|1418k   25M
  6   0  86   7   0   0|1277k 1563k
  8   1  84   8   0   0|1847k 2013k
  8   1  84   7   0   0|1831k 4063k
 13  47  35   5   0   0|1974k 7948k
 12  28  55   5   0   0|1269k   16M
 10  19  64   7   0   0|1308k 2674k
 10  11  73   7   0   0|1474k 2590k
 15  65  18   3   0   0|1566k 4440k

 

CPU, Load, Disk I/O and Memory

Running “dstat -h” will show the options available.  Below is a script that shows some of the options I normally use. 

 cat dstat.sh

#!/bin/sh
echo
dstat -h | egrep "time|load|proc|cpu|disk|io|sys|vm" | egrep -v "cpu0|aio|filesystem|epoch|Usage"
echo

CURRENT_TIME=`date +"%m_%d_%Y_%H_%M"`

#dstat --time --load -p -c --disk --mem --top-cpu --top-bio --top-latency --output /home/oracle/rick/log/dstat_output_${CURRENT_TIME}_.csv 10
#dstat --time --load -p -c --disk --mem --top-cpu --top-bio --top-latency 10
dstat --time --load --proc --cpu --top-cpu --disk --io --sys --vm 60

exit 0

Below that is a sample run on a busy server.

 ./dstat.sh

Versatile tool for generating system resource statistics
Dstat options:
  -c, --cpu              enable cpu stats
  -d, --disk             enable disk stats
  -l, --load             enable load stats
  -p, --proc             enable process stats
  -r, --io               enable io stats (I/O requests completed)
  -t, --time             enable time/date output
  -y, --sys              enable system stats
  --vm                   enable vm stats
  -v, --vmstat           equals -pmgdsc -D total

----system---- ---load-avg--- ---procs--- ----total-cpu-usage---- -most-expensive- -dsk/total- --io/total- ---system-- -----virtual-memory----
  date/time   | 1m   5m  15m |run blk new|usr sys idl wai hiq siq|  cpu process   | read  writ| read  writ| int   csw |majpf minpf alloc  free
15-10 14:17:19|15.9 21.3 24.1|0.0 0.0 150|  6   7  83   4   0   0|ora_as04_LASP0.2|  89M   33M|1141  1095 |  24k   21k|   0    31k   52k   52k
15-10 14:18:19|30.5 24.5 25.0| 13 6.2 465|  8  15  72   5   0   0|oracleORCL  1.0|  32M   21M|1674  1273 |  43k   31k|   0   122k   91k   91k
15-10 14:19:19|22.8 23.0 24.5| 11 4.6 473|  6  12  77   5   0   0|oracleORCL  1.0|  25M   15M|1645  1062 |  40k   30k|   0   115k   82k   84k
15-10 14:20:19|23.6 22.9 24.3| 12 5.2 476|  6  13  76   5   0   0|oracleORCL  1.2|  66M   13M|1716  1127 |  40k   29k|   0   117k   86k   86k
15-10 14:21:19|14.9 20.5 23.4|5.3 5.2 467|  3   6  86   5   0   0|oracleORCL  0.4|  28M   14M|1530  1069 |  32k   26k|   0    99k   57k   57k
15-10 14:22:19|20.5 20.6 23.2|8.8 6.4 466|  5  10  80   5   0   0|oracleORCL  0.8|  70M   20M|1824  1296 |  39k   32k|   0   104k   73k   73k
15-10 14:23:19|15.7 19.2 22.6| 12 7.3 476|  6  12  76   6   0   0|oracleORCL  1.5|  39M   18M|1840  1218 |  41k   33k|   0   117k   89k   89k
15-10 14:24:19|15.8 18.6 22.2| 12 7.5 278|  7  11  75   6   0   0|oracleORCL  1.3| 160M   95M|2142   885 |  37k   30k|   0    64k   77k   77k
15-10 14:25:19|28.2 22.4 23.3| 18 7.5 203|  8  22  65   5   0   0|oracleORCL  1.1|  98M   58M|2608   684 |  42k   31k|   0    70k  110k  110k
15-10 14:26:19|31.6 23.8 23.7| 12 6.8 176|  7  13  75   5   0   0|oracleORCL  1.1|  54M   14M|1944   715 |  30k   25k|   0    39k   56k   57k missed 2 ticks
15-10 14:27:19|32.0 26.4 24.6| 18 4.8 200|  6  20  70   4   0   0|oracleORCL  0.9|  30M   17M| 932  1214 |  37k   27k|   0    72k   98k   98k
15-10 14:28:19|50.7 32.5 26.8| 26 5.3 227| 10  34  52   4   0   0|oracleORCL  1.3|  55M   20M|1200  1088 |  47k   25k|   0   108k  152k  152k missed 2 ticks
15-10 14:29:19|35.4 31.4 26.8| 22 4.5 217|  7  26  64   3   0   0|oracleORCL  0.8|  13M   22M|1071  1113 |  40k   23k|   0    94k  127k  127k
15-10 14:30:19|30.9 30.8 26.8| 20 3.5 212| 11  23  63   3   0   0|oracleORCL  1.5|  70M   16M|1062  1426 |  37k   20k|   0    83k   98k   98k missed 2 ticks
15-10 14:31:19|26.7 28.9 26.4| 10 2.4 182|  7  11  79   3   0   0|oracleORCL  1.0|  38M   16M| 786   892 |  27k   19k|   0    59k   59k   59k
15-10 14:32:19|15.7 25.4 25.4| 18 2.5 208|  6  23  69   2   0   0|oracleORCL  0.7|  53M   16M| 577  1012 |  33k   17k|   0    85k  107k  108k
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s