Package: iostat-tool
iostat-toolparse and visualize iostat outputRequirementsMatplotlibSupport output of iostat for Linux onlyiostatcommand needs-targument to get timestamp, and-ymxt 1arguments are recommended$maniostat-tPrintthetimeforeachreportdisplayed.ThetimestampformatmaydependonthevalueoftheS_TIME_FORMATenvironmentvariable(seebelow).How to installfor user$pipinstalliostat-toolfor developerCreate venv to installiostat-tool.$mkdirvenvs
$python3-mvenvvenvs/venv
$sourcevenvs/venv/bin/activate(venv)$Installiostat-toolpackage from the repository.(venv)$gitclonehttps://github.com/t2y/iostat-tool.git(venv)$cdiostat-tool(venv)$pythonsetup.pydevelopBase CLI optionsConfirmiostat-cliworks as below.(venv)$iostat-cli--help
usage:iostat-cli[-h][--backendBACKEND][--dataDATA][--fig-outputFIGOUTPUT][--fig-sizeFIGSIZE][--outputOUTPUT][--disksDISKS[DISKS...]][--sinceSINCE][--untilUNTIL][-v][--version]{csv,monitor,plot}...

positionalarguments:{csv,monitor,plot}optionalarguments:-h,--helpshowthishelpmessageandexit--backendBACKENDsetbackendformatplotlib,useTkAggtomonitorintheforeground--dataDATAsetpathtoiostatoutputfile--fig-outputFIGOUTPUTsetpathtosavegraph--fig-sizeFIGSIZEsetfiguresize--outputOUTPUTsetpathtosaveoutputofiostat--disksDISKS[DISKS...]setdisknameiniostat--sinceSINCEsetsincedatetime,format:yyyymmddHHMISS--untilUNTILsetuntildatetime,format:yyyymmddHHMISS-v,--verbosesetverbosemode--versionshowprogramversionSub CommandscsvCreate csv/tsv file from output of iostat.(venv)$iostat-clicsv--help
usage:iostat-clicsv[-h][--dialect{excel,excel-tab,unix}][--separator{comma,tab}]optionalarguments:-h,--helpshowthishelpmessageandexit--dialect{excel,excel-tab,unix}setdialectforcsvwriter,defaultisexcel--separator{comma,tab}setseparator,defaultiscommaplotCreate image file rendered by matplotlib from output of iostat.(venv)$iostat-cliplot--help
usage:iostat-cliplot[-h][--plot-type{plotter,scatter}][--subplots{io_rqm,iops,io_transfer,%util,avgrq-sz,avgqu-sz,await,svctm}[{io_rqm,iops,io_transfer,%util,avgrq-sz,avgqu-sz,await,svctm}...]][--vlinesVLINES[VLINES...]]optionalarguments:-h,--helpshowthishelpmessageandexit--plot-type{plotter,scatter}setplottype("plotter"bydefault)--subplots{io_rqm,iops,io_transfer,%util,avgrq-sz,avgqu-sz,await,svctm}[{io_rqm,iops,io_transfer,%util,avgrq-sz,avgqu-sz,await,svctm}...]setsubplotstoshow--vlinesVLINES[VLINES...]setverticalline,format:yyyymmddHHMISS--x-datetime-formatX_DATETIME_FORMATsetdatetimeformatfordevicesx-axis--titleTITLEsettitleforgraph--without-cpudon'tplotCPUdata--cpu-onlyplotonlyCPUdatamonitorMonitor and logging output ofiostatcommand.(venv)$iostat-climonitor--help
usage:iostat-climonitor[-h][--iostat-argsIOSTAT_ARGS][--max-queue-sizeMAX_QUEUE_SIZE]optionalarguments:-h,--helpshowthishelpmessageandexit--iostat-argsIOSTAT_ARGSsetargumentsforiostat--max-queue-sizeMAX_QUEUE_SIZEsetqueuesizetoreadiostatoutputHow to useThis is sample image rendered by matplotlib.there is already an iostat.ouput as data fileplotshow all subplots of /dev/sda and cpu average(venv)$iostat-cli--datatests/fixtures/sample_iostat.output--disksda--fig-outputmy-iostat.pngplot(venv)$filemy-iostat.png
my-iostat.png:PNGimagedata,1800x1400,8-bit/colorRGBA,non-interlacedshow any subplots of /dev/sda and cpu averagefilterio_rqmandiopswith--subplots(venv)$iostat-cli--datatests/fixtures/sample_iostat.output--disksda--fig-outputmy-iostat.png\plot--subplotsio_rqmiopsshow any range of date timefilter since 2018-06-13 14:11:00 with--sincefilter until 2018-06-13 14:11:30 with--until(venv)$iostat-cli--datatests/fixtures/sample_iostat.output--disksda--fig-outputmy-iostat.png\--since20180613141100--until20180613141130plot--subplotsawaitsvctmshow vertical lines into graph2018-06-13 14:11:10 and 2018-06-13 14:11:20 with--vlines(venv)$iostat-cli--datatests/fixtures/sample_iostat.output--disksda--fig-outputmy-iostat.png\--since20180613141100--until20180613141130plot--subplotsawaitsvctm--vlines2018061314111020180613141120show only CPU-related data(venv)$iostat-cli--datatests/fixtures/sample_iostat.output--disksda--fig-outputmy-iostat.png\plot--cpu-onlyshow only one subplot, without CPU information(venv)$iostat-cli--datatests/fixtures/sample_iostat.output--disksda--fig-outputmy-iostat.png\plot--subplotsawait--without-cpugenerate graph with custom title(venv)$iostat-cli--datatests/fixtures/sample_iostat.output--disksda--fig-outputmy-iostat.png\plot--title'my custom test'csvoutput 2 csv files (iostat_cpu.csv and iostat_devices.csv)(venv)$iostat-cli--datatests/fixtures/sample_iostat.output--outputiostat.csvcsv(venv)$lsiostat_*.csv
iostat_cpu.csviostat_devices.csv(venv)$head-n3iostat_*.csv==>iostat_cpu.csv<==datetime,%user,%nice,%system,%iowait,%steal,%idle2018-06-1314:10:50,0.47,0.0,0.24,0.18,0.0,99.112018-06-1314:10:51,3.07,0.0,0.66,0.09,0.0,96.18==>iostat_devices.csv<==datetime,device,rrqm/s,wrqm/s,r/s,w/s,rMB/s,wMB/s,avgrq-sz,avgqu-sz,await,r_await,w_await,svctm,%util2018-06-1314:10:50,sdd,0.07,45.88,1.57,0.59,0.08,0.18,246.55,0.26,121.04,1.28,436.94,2.07,0.452018-06-1314:10:50,sdh,0.07,45.78,1.59,0.6,0.08,0.18,245.64,0.22,101.97,1.17,367.51,1.89,0.41run iostat and logging the outputmonitor iostat command runningalmost the same asiostat -yxmt 1 | tee my-iostat.log(venv)$iostat-cli--outputmy-iostat.log--fig-outputmy-scatter.pngmonitor--iostat-args"-yxmt 1"...06/13/201810:11:07PM
avg-cpu:%user%nice%system%iowait%steal%idle0.940.000.030.000.0099.03

Device:rrqm/swrqm/sr/sw/srMB/swMB/savgrq-szavgqu-szawaitr_awaitw_awaitsvctm%util
sda0.000.000.000.000.000.000.000.000.000.000.000.000.0006/18/201810:11:08PM
avg-cpu:%user%nice%system%iowait%steal%idle0.160.000.060.000.0099.78
...(Ctrl+C)# stop to run iostat(venv)$filemy-iostat.logmy-scatter.png
my-iostat.log:ASCIItext
my-scatter.png:PNGimagedata,1800x1300,8-bit/colorRGBA,non-interlacedNOTE: Savingmy-scatter.pngis experimental feature when io-stat terminated, so it might fails to save the figure.