Monthly Archives: May 2014

dstat – benchmark stats in one place

IMG_9511I’ve been using dstat for awhile now and I figured I should blog about it. I’m always surprised when I meet techies that benchmark but don’t know about dstat? How can that be?? It’s like iostat, vmstat and a bunch of other tools we all use in one. ok I hear ya, when you have a “swiss army knife” of tools using them can be a challenge so I thought I’d blog about the ways I’m using it.

First you may want to look at man page sorts of things:

http://dag.wiee.rs/home-made/dstat/

http://www.onaxer.com/2011/03/25/disk-io-performance-tuning-benchmarking-tool/

Because I’m using dstat for benchmarking, that means that biz folks are gonna look at the results and they all want graphs. The cool thing about dstat is that you can output it into a csv file. Graphite, a commonly used monitoring tool uses csv files. But I don’t have access to a Graphite server so I’ll make my graphs with another tool. Here’s what my dstat wrapper looks like (I also have hdparm )

system-check.sh

#!/bin/bash

#####################################
## VARIABLES
#####################################
DELAY=3
COUNT=10
SLEEP=10
MAX=10
NOW=`date +”%Y%m%d%H%M”`
STATS_DIR=/data/reports/dstat
OUTPUT_FILE=${STATS_DIR}/${NOW}-dstat.csv
#DSTAT=”dstat -t –top-io –top-bio -cl”
DSTAT=”dstat -t –top-io –top-bio -cl –disk-util”
HDPARM_LOG=/tmp/${NOW}-hdparm.log

## check if stats dir exists
if [ ! -d ${STATS_DIR} ]; then
#echo “no ${STATS_DIR} ”
mkdir -p ${STATS_DIR}
fi

for i in `seq 1 ${MAX}` ; do
(${DSTAT} –output ${OUTPUT_FILE} $DELAY $COUNT )
(echo `date` >> ${HDPARM_LOG} )
(/sbin/hdparm -Tt /dev/xvda >> ${HDPARM_LOG})
sleep $SLEEP
done

exit 0

#################