This tool, simply takes the output from iotstat, parsers the data to some degree, and creates plots and an HTML report. The intent is to allow plot the time history of the IO rather than have to stare at numbers flashing by on the command line.

There are several versions of iostat_plotter. The first version, below corresponds to the version used in the article in HPC-Admin magazine, (here), and can be downloaded. The second version, is an enhanced version that can capture and plot data for more than one device. It also has a serialization capability (“pickle” in Python-speak) that allows you to save the data structures for use elsewhere.

Both versions are covered under the GPLv2 license.

Article Version:

This version is labeled “”. This corresponds to the version in the HPC-Admin Magazine article.

This script can only examine one device at a time. You need to get the iostat output using the command

[laytonj@home8 IOSTAT]$ iostat -c -d -x -t -m /dev/sda 1 100 > 

where /dev/sda is the specific device you want to monitor which is up to you (in this version you need to use a specific device), “1 100” which tells iostat to use “1” second intervals and “100” means to gather 100 data samples (or 100 sceonds in this case).

After running iostat, you then run iostat_plotter_article to create the HTML document with the plots. The command is,

[laytonjb ~]$ iostat.out

where “iostat.out” is the output from iostat. The code is written in Python (obviously) and uses the shlex, time, os, and matplotlib modules.

When iostat_plotter_article is done it will create a subdirectory “HTML_REPORT” that contains the plots and an html file “report.html”. Open that html file in a browser or word processor and you will see the plots and a small write-up about them. Feel free to modify the code but please send back changes.

An example of the html output is here. You can download the file using this link (sorry – I have to use dropbox because WordPress does not allow .py files).

Enhanced Version:

This version of iostat_plotter can be found by going to this page.

34 Responses to IOstat_plotter

  1. Rajan says:

    where can i download “”

  2. jwow says:

    hello, i’m getting “cannot import shlex module” error when i ran the script? can you point me to right direction please. ty

    • Sorry for the delayed reply. I don’t know anything about your Python build but shlex is typically built with most Python distributions. I would ask the list for your distribution.

      • There’s a typo in the script where all try, except sequences print out “Cannot import shlex” regardless of the import module. Hence OP could have been facing this error with matplotlib like I did.

        As a side note, you could have place your script on github (or else), and user like myself could have contributed back on submitting or fixing issues.

      • Pascal,

        Try V3 of the IOstat_plot script. I just looked at it and it gives the correct module and not just “shelex”. If you still get the problems with V3 then maybe I did something screwy on the upload.

        As for github, I have no problem putting things there. It’s just that I’m a dinosaur don’t use or git for this code. This code was just intended to be a simple example code that others could run take and run with. It hasn’t turned out that way though so maybe I should learn how to use github? 🙂

  3. Ken says:

    Ditto…don’t see a link for the enhanced version.

  4. david says:

    looks great , but minor fix (even before I ran it):
    you try and catch exception for importing various modules – but you give the same error with shlex…
    I did not have the matplotlib.pyplot module but search for shlex for an hour before realizing this is not the missing part…

  5. david says:

    another comment – can you show the expected output of iostat?
    I fail because my iostat output looks like this:
    Linux 2.6.32-279.el6.x86_64 (h85) 07/17/2013 _x86_64_ (16 CPU)

    07/17/2013 06:16:42 PM
    avg-cpu: %user %nice %system %iowait %steal %idle
    4.37 0.00 1.38 0.00 0.00 94.24

    Device: rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await svctm %util
    sda 0.01 10.97 0.02 4.74 0.00 0.06 26.54 0.02 3.62 0.18 0.09

    and I get this error:
    Storing Device values
    Traceback (most recent call last):
    File “./”, line 362, in
    IndexError: list index out of range
    – it seems that you expect to get more fields than I have

    • Kamal says:

      Hello David,

      Have you fixed that svctm_list.append(float(currentline[12])); I have the same output,

      thank you for you feedback

      • Kamal,

        When I see this error it’s usually because it’s an older version of sysstat (version 9.x). Pleas upgrade sysstat to the latest (10.21 I think) and re-run iostat to collect updated statistics.


  6. david says:

    OK – I’ve find it – the difference is between ubuntu’s iostat and RHEL version of it
    now I need to find how to plot multiple devices in the same graphs – i have 12 internal disks and i write to all of them in the same time..

  7. cstpierre2 says:

    question, have you uploaded the non article version file? I don’t see the link to that…

    • Apologies – I had the code finished but I just kept forgetting to upload it. It should be there now. The URL for it is You can also go to the page about iostat_plotter and the link should work. If it doesn’t, please let me know.

      Thanks! (and apologies)


  8. Pingback: IOSTAT Plotter V2 | clusterbuffer

  9. Barry says:

    I have it all working on my 12.10 ubuntu, but on AWS Ubuntu and RH (32 & 64) instances, all I get is the report.html being generated. Know what is happening to the rest of the html and all the pngs?

    great stuff btw

    • Barry,

      One thing to consider is matplotlib needs X. Be sure X is on the AWS images. You also need to tunnel X to the AWS when using ssh (“ssh -X”). Try this and let’s see what happens.


  10. Barry says:

    On AWS, Ubuntu and RH, if I run iostat x, y; seconds between and number of times, only the first data is populated. If I run a script for i in {1..10}, I get data every time. Any way to correct the former?

    • Barry – I’m not sure. Running it as “iostat x y” (no comma) should work fine. Can you check what version of iostat you’re running? You may need to get a newer version.


  11. Barry says:

    hi Jeff, x,y,, interval and count. the first interval shows up fine. All the others are zero. Version of sysstat is 9.0.4. Running an ec2 instance, and all is updated. Here is the message from your python script
    reading iostat output file …
    Finished reading 10 data points for 0 devices.
    Creating plots and HTML report

    all i get is a short html report, , no pngs

    • Barry,

      Ah. This is an older version of sysstat. iostat_plotter relies on version 10.x of iostat (I’ve tested 10.2). You might have to actually build sysstat on you instance (it’s not hard and it builds very quickly).

      In the meantime, I’ll take a look at sysstat v9.x. Some other people use v9.x as well. The last release of v9.x was over 4 years ago. Some of these distros need to catch up 🙂


  12. Barry says:

    see below. I did install the new iostat, quite confused here! worked first time on my Ubuntu 12.10 machine.

    [ec2-user@ip-172-31-44-102 files]$ iostat -c -d -x -t -m /dev/xvde1 2 12 > 2.out
    [ec2-user@ip-172-31-44-102 files]$ sudo python 2.out
    iostat plotting script

    input filename: 2.out

    reading iostat output file …
    Finished reading 12 data points for 0 devices.
    Creating plots and HTML report
    Finished. Please open the document HTML/report.html in a browser.
    [ec2-user@ip-172-31-44-102 files]$ iostat -V
    sysstat version 10.2.0
    (C) Sebastien Godard (sysstat
    [ec2-user@ip-172-31-44-102 files]$ sudo iostat -V
    sysstat version 9.0.4
    (C) Sebastien Godard (sysstat

  13. mark says:

    Hi There
    Any idea what the error below is, I have all the python modules installed as well as updating my sysstat to 10.2.1
    iostat -x -t -d -m 1 100 dm-5 > /tmp/iostat — tried it with /devsdx also


    iostat plotting script

    input filename: iostat2

    reading iostat output file …
    Traceback (most recent call last):
    File “”, line 423, in
    if (currentline[2] == “PM”):
    IndexError: list index out of range

    • Mark,

      Sorry for my slow response – can you tell where in your iostat output that the code is choking? If so, post a few lines before and after where it chokes.



  14. Pingback: IOSTAT Plotter and NFSiostat plotter updates (V3!) | clusterbuffer

  15. Sunny says:

    The python script is not compatible with all versions on iostat i believe.
    I got many errors when running against my .out file. I tried to fix these issues by turning off some flags, but there were too many of them.
    Here is a sample of my .out file

    Linux 2.6.18-348.el5 (xxxxx) 04/20/2014

    Time: 09:21:56 PM
    Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
    sda2 0.00 2.91 0.01 0.47 0.16 13.50 57.04 0.00 3.05 0.23 0.01

    Time: 09:22:01 PM
    Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
    sda2 0.00 7.40 0.00 1.00 0.00 33.60 67.20 0.00 0.80 0.40 0.04

    Time: 09:22:06 PM
    Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
    sda2 0.00 4.40 0.00 0.60 0.00 20.00 66.67 0.00 0.33 0.33 0.02

    Note, there is no CPU information (system info in the output)

    I am using sysstat-7.0.2-12.el5

    • Sunny,

      I’m sorry you’re having trouble. Did you run iostat with the flags I recommend? (iostat -c -d -x -t -m).

      Second, that release of sysstat was in 2006 (8 years ago). That is pretty old. If possible I recommend upgrading your version of sysstat to some newer. If you continue to have problems I will see what I can do to help.


  16. Sunny says:

    I did use those flags.
    Apparently, i have installed the latest sysstat rpm available in my yum repo.

    I will try to get a newer one if available.

    Also, for now, i did some painful extra work and graphed the data using microsoft excel 🙂


  17. Raj says:

    Great script. I have a question I need to collect data across multiple servers using fabric python and check which VM has high nfs and I/O activities. Can this be done using nfsiostat plotter ?

  18. gdrub13 says:


    $ /usr/local/bin/iostat -V
    sysstat version 11.1.2
    (C) Sebastien Godard (sysstat

    $ /usr/local/bin/iostat -c -d -x -t -m /dev/sda1 2 12 > iostat.out

    $ sudo python iostat.out
    [sudo] password for XXXXX:
    combined_plots = 0
    iostat plotting script

    input filename: iostat.out

    reading iostat output file …
    Traceback (most recent call last):
    File “”, line 2252, in
    if (currentline[2] == “PM”):
    IndexError: list index out of range

    $ head -n9 iostat.out
    Linux 3.13.0-24-generic (mc-ab) 30/12/2014 _x86_64_ (2 CPU)

    30/12/2014 09:23:01
    avg-cpu: %user %nice %system %iowait %steal %idle
    14,31 0,10 1,96 0,49 0,00 83,13

    Device: rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
    sda1 0,04 0,00 0,01 0,00 0,00 0,00 52,37 0,00 12,57 12,54 14,86 6,80 0,00

    How can I fix it ?

    Thx so much.

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s

%d bloggers like this: